-
Notifications
You must be signed in to change notification settings - Fork 114
Object stats #616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Object stats #616
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments so far; posting before switching threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks quite nice. ISTR snmalloc
of old had the ability to conditionally keep stats or not; perhaps it would be worth having an empty implementation of the Stat
and MonotoneStat
interfaces and either templating or having a namespace snmalloc
-scoped using
to pick between them?
src/snmalloc/mem/globalalloc.h
Outdated
@@ -87,6 +87,10 @@ namespace snmalloc | |||
} | |||
} | |||
|
|||
if ( | |||
result == nullptr && RemoteDeallocCache::remote_inflight.get_curr() != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something has happened (TM) with the syntax there. Can this be a SNMALLOC_ASSERT_MSG
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks quite nice. ISTR snmalloc
of old had the ability to conditionally keep stats or not; perhaps it would be worth having an empty implementation of the Stat
and MonotoneStat
interfaces and either templating or having a namespace snmalloc
-scoped using
to pick between them?
I was going to profile to see how much the operations cost. If they are noticeable, then I will macro it away as you suggest. |
This adds a collection of per sizeclass statistic for tracking how many allocations have occurred on each thread. These are racily combined to provide basic tracking information.
f576431
to
bfc415a
Compare
So I have benchmarked this, and it has a perf regression. The worst case seems to be 3% (glibc-thread), but most tests are below 1%. I am going to investigate moving more of the statistics off the fast path. This will basically be,
This will over approximate the current user allocations quite a bit, but should make the overhead practically zero. Alternatively, we could look at making this a compile time option. |
This adds some statistic for tracking
The per sizeclass statistics are tracked per allocator, and a racy read is done to combine the results for displaying.
These statistics were used to debug #615 to calculate the fragmentation.
The displayed statistics are intended for post processing to calculate the fragmentation/utilisation.
The interface just prints the results using
message
. This could be improved with a better logging infrastructure.