CollectionSizeLog
Ecng.Logging
Tracks sizes of named data sources (collections, queues, buffers) and can produce a snapshot or dump only the ones that grew since the last snapshot. Thread-safe.
Methoden
Format
public static string Format(IReadOnlyList<ValueTuple<string, long>> snapshot)
result = CollectionSizeLog.Format(snapshot)
Formats a snapshot as a single log-friendly line.
FormatGrowing
public static string FormatGrowing(IReadOnlyList<ValueTuple<string, long, long>> snapshot)
result = CollectionSizeLog.FormatGrowing(snapshot)
Formats a growing snapshot as a single log-friendly line.
Snapshot
public IReadOnlyList<ValueTuple<string, long>> Snapshot()
result = collectionSizeLog.Snapshot()
Returns a snapshot of all tracked sizes as name→value pairs. Updates the internal previous-size cache.
SnapshotGrowing
public IReadOnlyList<ValueTuple<string, long, long>> SnapshotGrowing()
result = collectionSizeLog.SnapshotGrowing()
Returns only the sources that grew since the last Snapshot or SnapshotGrowing call.
Track
public void Track(Func<long> sizeFunc, string name)
collectionSizeLog.Track(sizeFunc, name)
Registers a named data source whose size will be tracked.
- sizeFunc
- Delegate returning the current size.
- name
- Human-readable name for the counter.
Untrack
public void Untrack(string name)
collectionSizeLog.Untrack(name)
Unregisters a tracked source.