grunning

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package grunning is a library that's able to retrieve on-CPU running time for individual goroutines. It relies on using a patched Go and provides a primitive for fine-grained CPU attribution and control. See #82356 for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(a, b time.Duration) time.Duration

Difference is a helper function to compute the absolute difference between two durations.

func Elapsed

func Elapsed(start, end time.Duration) time.Duration

Elapsed returns the running time spent doing some piece of work, with grunning.Time() measurements from the start and end.

NB: This only exists due to grunning.Time()'s non-monotonicity, a bug in our runtime patch: https://github.com/cockroachdb/cockroachdb-parser/issues/95529. We can get rid of this, keeping just grunning.Difference(), if that bug is fixed. The bug results in slight {over,under}-estimation of the running time (the latter breaking monotonicity), but is livable with our current uses of this library.

func Supported

func Supported() bool

Supported returns true iff per-goroutine running time is available in this build. We use a patched Go runtime for all platforms officially supported for CRDB when built using Bazel.

func Time

func Time() time.Duration

Time returns the time spent by the current goroutine in the running state.

Types

This section is empty.

Jump to

Keyboard shortcuts

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