Skip to content

Commit e78e2e8

Browse files
committed
Per allocation stats
1 parent 6e524ea commit e78e2e8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/snmalloc/mem/globalalloc.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,23 @@ namespace snmalloc
137137
}
138138
}
139139

140-
template<SNMALLOC_CONCEPT(ConceptBackendGlobals) SharedStateHandle>
140+
template<SNMALLOC_CONCEPT(IsConfig) Config>
141141
inline static AllocStats get_stats()
142142
{
143-
auto alloc = AllocPool<SharedStateHandle>::iterate();
143+
auto alloc = AllocPool<Config>::iterate();
144144
AllocStats stats;
145145
while (alloc != nullptr)
146146
{
147147
stats += alloc->get_stats();
148-
alloc = AllocPool<SharedStateHandle>::iterate(alloc);
148+
alloc = AllocPool<Config>::iterate(alloc);
149149
}
150150
return stats;
151151
}
152152

153-
template<SNMALLOC_CONCEPT(ConceptBackendGlobals) SharedStateHandle>
153+
template<SNMALLOC_CONCEPT(IsConfig) Config>
154154
inline static void print_alloc_stats()
155155
{
156-
#ifndef SNMALLOC_PASS_THROUGH // This test depends on snmalloc internals
157-
auto stats = snmalloc::get_stats<SharedStateHandle>();
156+
auto stats = snmalloc::get_stats<Config>();
158157
for (size_t i = 0; i < snmalloc::SIZECLASS_REP_SIZE; i++)
159158
{
160159
auto sc = snmalloc::sizeclass_t::from_raw(i);
@@ -167,6 +166,5 @@ namespace snmalloc
167166
auto in_use = allocated - deallocated;
168167
snmalloc::message<1024>("SNMALLOCallocs,{},{},{},{},{}", i, size, allocated, deallocated, in_use);
169168
}
170-
#endif
171169
}
172170
} // namespace snmalloc

0 commit comments

Comments
 (0)