rusage

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDiff

func FormatDiff(diff Rusage) string

FormatDiff formats the result of rusage.Rusage.Subtract() for logging.

func Supported

func Supported() bool

Supported returns true if resource usage counters are supported on this OS.

Types

type Rusage

type Rusage struct {
	Date              time.Time
	Elapsed           time.Duration
	Utime, Stime      time.Duration
	Inblock, Outblock int64
}

Rusage is a subset of a Unix-style resource usage counter for the current process and its children. The counters are always 0 on platforms where the system call is not available (i.e., systems where getrusage() doesn't exist).

func Get

func Get() (Rusage, error)

Get returns the counters for the current process and its children, subtracting any values in the passed in "since" value, or an error. The Elapsed field will always be set to zero.

func (Rusage) Subtract

func (r Rusage) Subtract(baseline Rusage) Rusage

Subtract subtracts the items in delta from r, and returns the difference. The Date field is zeroed for easier comparison with the zero value for the Rusage type.

Jump to

Keyboard shortcuts

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