Lines Matching refs:entry
29 void AllocGetData(const std::string& line, AllocEntry* entry) { in AllocGetData() argument
38 if (sscanf(line.c_str(), "%d: %127s %" SCNx64 " %n", &entry->tid, name, &entry->ptr, &line_pos) != in AllocGetData()
47 if (sscanf(line_end, "%zu", &entry->size) != 1) { in AllocGetData()
50 entry->type = MALLOC; in AllocGetData()
54 entry->type = FREE; in AllocGetData()
58 if (sscanf(line_end, "%" SCNd64 " %zu", &entry->u.n_elements, &entry->size) != 2) { in AllocGetData()
61 entry->type = CALLOC; in AllocGetData()
65 if (sscanf(line_end, "%" SCNx64 " %zu", &entry->u.old_ptr, &entry->size) != 2) { in AllocGetData()
68 entry->type = REALLOC; in AllocGetData()
72 if (sscanf(line_end, "%" SCNd64 " %zu", &entry->u.align, &entry->size) != 2) { in AllocGetData()
75 entry->type = MEMALIGN; in AllocGetData()
77 entry->type = THREAD_DONE; in AllocGetData()
83 bool AllocDoesFree(const AllocEntry& entry) { in AllocDoesFree() argument
84 switch (entry.type) { in AllocDoesFree()
92 return entry.ptr != 0; in AllocDoesFree()
95 return entry.u.old_ptr != 0; in AllocDoesFree()
99 static uint64_t MallocExecute(const AllocEntry& entry, Pointers* pointers) { in MallocExecute() argument
102 void* memory = malloc(entry.size); in MallocExecute()
103 MakeAllocationResident(memory, entry.size, pagesize); in MallocExecute()
106 pointers->Add(entry.ptr, memory); in MallocExecute()
111 static uint64_t CallocExecute(const AllocEntry& entry, Pointers* pointers) { in CallocExecute() argument
114 void* memory = calloc(entry.u.n_elements, entry.size); in CallocExecute()
115 MakeAllocationResident(memory, entry.u.n_elements * entry.size, pagesize); in CallocExecute()
118 pointers->Add(entry.ptr, memory); in CallocExecute()
123 static uint64_t ReallocExecute(const AllocEntry& entry, Pointers* pointers) { in ReallocExecute() argument
125 if (entry.u.old_ptr != 0) { in ReallocExecute()
126 old_memory = pointers->Remove(entry.u.old_ptr); in ReallocExecute()
131 void* memory = realloc(old_memory, entry.size); in ReallocExecute()
132 MakeAllocationResident(memory, entry.size, pagesize); in ReallocExecute()
135 pointers->Add(entry.ptr, memory); in ReallocExecute()
140 static uint64_t MemalignExecute(const AllocEntry& entry, Pointers* pointers) { in MemalignExecute() argument
143 void* memory = memalign(entry.u.align, entry.size); in MemalignExecute()
144 MakeAllocationResident(memory, entry.size, pagesize); in MemalignExecute()
147 pointers->Add(entry.ptr, memory); in MemalignExecute()
152 static uint64_t FreeExecute(const AllocEntry& entry, Pointers* pointers) { in FreeExecute() argument
153 if (entry.ptr == 0) { in FreeExecute()
157 void* memory = pointers->Remove(entry.ptr); in FreeExecute()
163 uint64_t AllocExecute(const AllocEntry& entry, Pointers* pointers) { in AllocExecute() argument
164 switch (entry.type) { in AllocExecute()
166 return MallocExecute(entry, pointers); in AllocExecute()
168 return CallocExecute(entry, pointers); in AllocExecute()
170 return ReallocExecute(entry, pointers); in AllocExecute()
172 return MemalignExecute(entry, pointers); in AllocExecute()
174 return FreeExecute(entry, pointers); in AllocExecute()