profiling

package
v0.0.0-...-5c85c1b Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package profiling provides support for easily doing CPU and memory profiling from within Go programs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(cpu string, mem string) func()

Start starts profiling, saving cpu and memory profiles to the specified cpu and mem filenames. To disable cpu/mem profiling, specify blank strings for the cpu and/or mem filenames.

Note - timestamps will be automatically added to the filenames to ensure uniqueness. For example "mem.prof" becomes "mem_20150119_080853.639750789.prof".

Start returns a function that finishes profiling. It can be useful to call in a defer in your main method, for example.

Start also installs a handler for SIGINT that saves profiling information if the process receives a SIGINT.

Example
finishProfiling := profiling.Start("cpu.prof", "mem.prof")
defer finishProfiling()
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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