Struct PeakMonitor¶
Defined in File peak_monitor.hpp
Struct Documentation¶
-
struct PeakMonitor¶
Hierarchy-wide co-resident memory high-water tracker.
A single
PeakMonitorcan be wired (viaCacheManager::set_peak_monitor) onto the root of a scope-chain ofCacheManagerinstances so everynote_working_set()call anywhere in the chain — root cache, per-batch scratch, nested scopes — folds into one running high-water mark, with a hook fired each time that mark advances (so a caller can capture where the current peak was observed, e.g. for a schedule visualizer).Public Functions
-
inline void observe(std::size_t bytes, std::size_t op_hash) noexcept¶
Observe one candidate high-water sample. Advances
hwmark_bytes(and fireson_peak) only ifbytesexceeds the current mark; a sample at or below the mark is a no-op.
Public Members
-
std::size_t hwmark_bytes = 0¶
Running high-water mark (bytes), monotonically non-decreasing.
-
PeakEvent peak = {}¶
Location of the current high-water (the event that last advanced
hwmark_bytes).
-
std::function<void(PeakEvent const&)> on_peak = {}¶
Optional callback fired each time
hwmark_bytesadvances (i.e. exactly whenpeakis updated). Empty (default) => no-op.
-
std::function<void(std::size_t total_bytes, std::vector<PeakLiveEntry> const&)> on_peak_liveset = {}¶
Diagnostic (analysis-only): optional callback fired — by
CacheManager::note_working_set, beforeobserveadvances the mark — each time a new global high-water is about to be recorded, carrying the total co-resident bytes and the full alive-entry set (chain-wide) at that instant. Empty (default) =>note_working_setnever enumerates the live set, so the fold costs nothing. Used to decompose a realized peak into its co-resident values.
-
inline void observe(std::size_t bytes, std::size_t op_hash) noexcept¶