debug

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: BSD-3-Clause Imports: 6 Imported by: 11

Documentation

Overview

Package debug provide global debug variable, initialized through environment variable "DEBUG" or directly.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Value contains DEBUG value from environment.
	Value = 0
)

Functions

func WriteHeapProfile

func WriteHeapProfile(prefix string, keepAlive bool)

WriteHeapProfile write memory profile into "/tmp/{prefix}.pid.heap.pprof". If keepAlive is true, the file will be keep opened until error happened, or caller send keepAlive=false, or when program end.

Types

type MemHeap

type MemHeap struct {
	// RelHeapAlloc difference between heap allocation, relative to the
	// first time this object initialized.
	RelHeapAlloc int64
	// RelHeapObjects difference between heap objects, relative to the
	// first time this object initialized.
	RelHeapObjects int64

	// DiffHeapObject different between last heap objects and with current
	// relative heap objects.
	// This value is equal to MemStats.Mallocs - MemStats.Frees.
	// If its positive its means the number of objects allocated,
	// otherwise its represent the number of objects freed.
	DiffHeapObjects int64
	// contains filtered or unexported fields
}

MemHeap store the difference between heap allocation.

func NewMemHeap

func NewMemHeap() (memHeap *MemHeap)

NewMemHeap create and initialize MemStatsDiff for the first time.

func (*MemHeap) Collect

func (msd *MemHeap) Collect()

Collect and compute the difference on the current heap allocation (in bytes) and heap objects.

Jump to

Keyboard shortcuts

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