Documentation ¶
Overview ¶
Package runtimez provides functionality supplemental to stdlib's runtime pkg.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MemStatsRefresh = time.Millisecond * 250
MemStatsRefresh determines how often the value returned by MemStats is refreshed.
Functions ¶
func MemStats ¶
MemStats returns the most recent memory stats. To avoid slamming the runtime, stats are retrieved periodically per MemStatsRefresh. The caller must not mutate the returned *runtime.MemStats, as the same instance is returned to other callers.
func StartMemStatsTracker ¶
func StartMemStatsTracker(ctx context.Context) (sys, curAllocs, totalAllocs, gcPauseNs *atomic.Uint64)
StartMemStatsTracker starts a goroutine that tracks memory stats, returning the peak values of runtime.MemStats.Sys, runtime.MemStats.TotalAlloc and runtime.MemStats.PauseTotalNs. The goroutine sleeps for sampleFreq between each sample and exits when ctx is done.
Types ¶
This section is empty.