Skip to content
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

Object stats #616

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Object stats #616

wants to merge 22 commits into from

Conversation

mjp41
Copy link
Member

@mjp41 mjp41 commented Jun 8, 2023

This adds some statistic for tracking

  • How many deallocations are in message queues.
  • How many allocators have been created.
  • Per sizeclass statistics
    • Number of objects allocated
    • Number of objects deallocated
    • Number of slabs allocated
    • Number of slabs deallocated

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.

@mjp41 mjp41 requested a review from nwf-msr June 8, 2023 11:35
Copy link
Contributor

@nwf-msr nwf-msr left a 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.

src/snmalloc/backend_helpers/statsrange.h Outdated Show resolved Hide resolved
src/snmalloc/ds_core/stats.h Show resolved Hide resolved
src/snmalloc/ds_core/stats.h Outdated Show resolved Hide resolved
src/snmalloc/mem/allocstats.h Outdated Show resolved Hide resolved
src/snmalloc/mem/corealloc.h Outdated Show resolved Hide resolved
Copy link
Contributor

@nwf-msr nwf-msr left a 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?

@@ -87,6 +87,10 @@ namespace snmalloc
}
}

if (
result == nullptr && RemoteDeallocCache::remote_inflight.get_curr() != 0)
Copy link
Contributor

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?

Copy link
Contributor

@nwf-msr nwf-msr left a 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?

@mjp41
Copy link
Member Author

mjp41 commented Jun 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants