pmem / CacheLib

Pluggable in-process caching engine to build and scale high performance services
https://www.cachelib.org
Apache License 2.0
5 stars 13 forks source link

[Upstreaming] Added per pool per class used size metrics #70

Closed guptask closed 2 years ago

guptask commented 2 years ago

This per pool size statistics reports the current size of each memory pool. Existing implementation does not report this statistic accurately. `allocAttempts - allocFailed - regularItemsEvictions - chainedItemsEvictions won't report this value accurately because pool size grows in multiples of block sizes. This statistics will be reported in the final report generated by cachebench.


This change is Reviewable

guptask commented 2 years ago

cachelib/allocator/CacheAllocator.h line 1119 at r2 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…
I'm not sure if Meta will be OK with adding such functions. Can't we use some existing ones? Some of the tests are also marked as friends of this class, so maybe we could use that?

We can raise the PR as it is here and see what Meta has to say about it. I think having an API approach is cleaner.

guptask commented 2 years ago

cachelib/allocator/tests/AllocatorHitStatsTest.h line 398 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…
please calculate this value based on slab size

I didn't understand your point. This check was pre-existing.