Skip to content

Commit

Permalink
[scudo] Dump ReleaseToOsIntervalMs (llvm#86887)
Browse files Browse the repository at this point in the history
This can be adjusted during runtime and it may impact the memory
footprint if it's set to a big value or is disabled.
  • Loading branch information
ChiaHungDuan authored Mar 28, 2024
1 parent 6373577 commit 6b149f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions compiler-rt/lib/scudo/standalone/primary64.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,11 @@ template <typename Config> class SizeClassAllocator64 {
PushedBlocks += Region->FreeListInfo.PushedBlocks;
}
}
const s32 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs);
Str->append("Stats: SizeClassAllocator64: %zuM mapped (%uM rss) in %zu "
"allocations; remains %zu\n",
"allocations; remains %zu; ReleaseToOsIntervalMs = %d\n",
TotalMapped >> 20, 0U, PoppedBlocks,
PoppedBlocks - PushedBlocks);
PoppedBlocks - PushedBlocks, IntervalMs >= 0 ? IntervalMs : -1);

for (uptr I = 0; I < NumClasses; I++) {
RegionInfo *Region = getRegionInfo(I);
Expand Down
10 changes: 6 additions & 4 deletions compiler-rt/lib/scudo/standalone/secondary.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,12 @@ template <typename Config> class MapAllocatorCache {
uptr Fractional;
computePercentage(SuccessfulRetrieves, CallsToRetrieve, &Integral,
&Fractional);
Str->append("Stats: MapAllocatorCache: EntriesCount: %d, "
"MaxEntriesCount: %u, MaxEntrySize: %zu\n",
EntriesCount, atomic_load_relaxed(&MaxEntriesCount),
atomic_load_relaxed(&MaxEntrySize));
const s32 Interval = atomic_load_relaxed(&ReleaseToOsIntervalMs);
Str->append(
"Stats: MapAllocatorCache: EntriesCount: %d, "
"MaxEntriesCount: %u, MaxEntrySize: %zu, ReleaseToOsIntervalMs = %d\n",
EntriesCount, atomic_load_relaxed(&MaxEntriesCount),
atomic_load_relaxed(&MaxEntrySize), Interval >= 0 ? Interval : -1);
Str->append("Stats: CacheRetrievalStats: SuccessRate: %u/%u "
"(%zu.%02zu%%)\n",
SuccessfulRetrieves, CallsToRetrieve, Integral, Fractional);
Expand Down

0 comments on commit 6b149f7

Please sign in to comment.