debug

package standard library
go1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2013 License: BSD-3-Clause Imports: 7 Imported by: 39,041

Documentation

Overview

Package debug contains facilities for programs to debug themselves while they are running.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreeOSMemory added in go1.1

func FreeOSMemory()

FreeOSMemory forces a garbage collection followed by an attempt to return as much memory to the operating system as possible. (Even if this is not called, the runtime gradually returns memory to the operating system in a background task.)

func PrintStack

func PrintStack()

PrintStack prints to standard error the stack trace returned by Stack.

func ReadGCStats added in go1.1

func ReadGCStats(stats *GCStats)

ReadGCStats reads statistics about garbage collection into stats. The number of entries in the pause history is system-dependent; stats.Pause slice will be reused if large enough, reallocated otherwise. ReadGCStats may use the full capacity of the stats.Pause slice. If stats.PauseQuantiles is non-empty, ReadGCStats fills it with quantiles summarizing the distribution of pause time. For example, if len(stats.PauseQuantiles) is 5, it will be filled with the minimum, 25%, 50%, 75%, and maximum pause times.

func SetGCPercent added in go1.1

func SetGCPercent(percent int) int

SetGCPercent sets the garbage collection target percentage: a collection is triggered when the ratio of freshly allocated data to live data remaining after the previous collection reaches this percentage. SetGCPercent returns the previous setting. The initial setting is the value of the GOGC environment variable at startup, or 100 if the variable is not set. A negative percentage disables garbage collection.

func Stack

func Stack() []byte

Stack returns a formatted stack trace of the goroutine that calls it. For each routine, it includes the source line information and PC value, then attempts to discover, for Go functions, the calling function or method and the text of the line containing the invocation.

This function is deprecated. Use package runtime's Stack instead.

Types

type GCStats added in go1.1

type GCStats struct {
	LastGC         time.Time       // time of last collection
	NumGC          int64           // number of garbage collections
	PauseTotal     time.Duration   // total pause for all collections
	Pause          []time.Duration // pause history, most recent first
	PauseQuantiles []time.Duration
}

GCStats collect information about recent garbage collections.

Jump to

Keyboard shortcuts

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