Unify statistic collection:

- For MI_STAT == 0 no allocation stats are collected
  - For MI_STAT == 1 only aggregated values (across normal, large and huge heaps) are collected
  - For MI_STAT == 1 separate per-bin collection for normal heap is done as well
This commit is contained in:
Anton Korobeynikov 2020-11-11 11:34:40 +03:00
parent 00fb89f771
commit 765fc9c0ca
5 changed files with 36 additions and 14 deletions

View file

@ -280,11 +280,14 @@ static bool _mi_heap_page_destroy(mi_heap_t* heap, mi_page_queue_t* pq, mi_page_
_mi_stat_decrease(&heap->tld->stats.huge, bsize);
}
}
#if (MI_STAT>1)
#if (MI_STAT)
_mi_page_free_collect(page, false); // update used count
const size_t inuse = page->used;
if (bsize <= MI_LARGE_OBJ_SIZE_MAX) {
mi_heap_stat_decrease(heap, normal, bsize * inuse);
#if (MI_STAT>1)
mi_heap_stat_decrease(heap, normal_bins[_mi_bin(bsize)], inuse);
#endif
}
mi_heap_stat_decrease(heap, malloc, bsize * inuse); // todo: off for aligned blocks...
#endif