runtimez

package
v0.48.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package runtimez provides functionality supplemental to stdlib's runtime pkg.

Index

Constants

This section is empty.

Variables

View Source
var MemStatsRefresh = time.Millisecond * 250

MemStatsRefresh determines how often the value returned by MemStats is refreshed.

Functions

func MemStats

func MemStats() *runtime.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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL