profiling

package
v0.0.0-...-7cd50c7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCPUUsage

func GetCPUUsage(fields []string, window time.Duration) []float32

Measures average CPU usage in the given time window and returns it as a floating point number between 0 and 1. ATTENTION: Blocks for the duration of the time window!

func StartCPUTracing

func StartCPUTracing(trace tracing.Trace, interval time.Duration)

func StartProfiler

func StartProfiler(name string, outFileName string, rate int)

Starts the profiler. StopProfiler needs to be called to finish profiling. For valid profiler names see the "runtime" package documentation. This implementation supports "cpu" as a special name for CPU profiling The outFileName argument designates the name of the output file to which profile data will be written after profiler is stopped. The rate is used for setting the "block" and "mutex" profile rate / fraction. Ignored for other names.

func StopOnSignal

func StopOnSignal(sig os.Signal, exit bool)

Sets up a signal handler that calls StopProfiler when the specified OS signal occurs. This is useful for profiling if the program does not terminate gracefully, but is stopped using an OS signal. StopOnSignal() can be used in this case to still obtain the profiler data. If the exit flag is set to true, the signal handler will exit the process after stopping the profiler.

func StopProfiler

func StopProfiler()

Stops all profilers started by StartProfiler() and dumps their output to their corresponding files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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