MCPcopy Create free account
hub / github.com/devosoft/avida / ExtractStats

Function ExtractStats

libs/tcmalloc-1.4/src/tcmalloc.cc:315–341  ·  view source on GitHub ↗

Get stats into "r". Also get per-size-class counts if class_count != NULL

Source from the content-addressed store, hash-verified

313
314// Get stats into "r". Also get per-size-class counts if class_count != NULL
315static void ExtractStats(TCMallocStats* r, uint64_t* class_count) {
316 r->central_bytes = 0;
317 r->transfer_bytes = 0;
318 for (unsigned int cl = 0; cl < kNumClasses; ++cl) {
319 const int length = Static::central_cache()[cl].length();
320 const int tc_length = Static::central_cache()[cl].tc_length();
321 const size_t size = static_cast<uint64_t>(
322 Static::sizemap()->ByteSizeForClass(cl));
323 r->central_bytes += (size * length);
324 r->transfer_bytes += (size * tc_length);
325 if (class_count) class_count[cl] = length + tc_length;
326 }
327
328 // Add stats from per-thread heaps
329 r->thread_bytes = 0;
330 { // scope
331 SpinLockHolder h(Static::pageheap_lock());
332 ThreadCache::GetThreadStats(&r->thread_bytes, class_count);
333 }
334
335 { //scope
336 SpinLockHolder h(Static::pageheap_lock());
337 r->system_bytes = Static::pageheap()->SystemBytes();
338 r->metadata_bytes = tcmalloc::metadata_system_bytes();
339 r->pageheap_bytes = Static::pageheap()->FreeBytes();
340 }
341}
342
343// WRITE stats to "out"
344static void DumpStats(TCMalloc_Printer* out, int level) {

Callers 3

DumpStatsFunction · 0.85
GetNumericPropertyMethod · 0.85
do_mallinfoFunction · 0.85

Calls 6

metadata_system_bytesFunction · 0.85
tc_lengthMethod · 0.80
ByteSizeForClassMethod · 0.80
SystemBytesMethod · 0.80
FreeBytesMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected