Documentation ¶
Index ¶
- Variables
- func CPUProfile(duration time.Duration) chan *Profile
- func CollectGCStats() collectFn
- func CollectMemStats() collectFn
- func CollectRoutinesStats() collectFn
- func CollectStats(reader func() []byte) collectFn
- func GCHandler(freq time.Duration) func(*websocket.Conn)
- func GoRoutinesHandler(freq time.Duration) func(*websocket.Conn)
- func LocationsToFuncNames(locations []*profile.Location) map[uint64]string
- func MemoryHandler(freq time.Duration) func(*websocket.Conn)
- func StartCPUProfHandler(w http.ResponseWriter, r *http.Request)
- func StopCPUProfHandler(w http.ResponseWriter, r *http.Request)
- func TickerHandler(freq time.Duration, fn collectFn) func(*websocket.Conn)
- type Node
- type Profile
Constants ¶
This section is empty.
Variables ¶
var ErrProfileFailed = errors.New("Could not start profiler")
Functions ¶
func CPUProfile ¶
Non-blocking function to get a profile
func CollectGCStats ¶
func CollectGCStats() collectFn
func CollectMemStats ¶
func CollectMemStats() collectFn
func CollectRoutinesStats ¶
func CollectRoutinesStats() collectFn
func CollectStats ¶
func CollectStats(reader func() []byte) collectFn
func LocationsToFuncNames ¶
func StartCPUProfHandler ¶
func StartCPUProfHandler(w http.ResponseWriter, r *http.Request)
func StopCPUProfHandler ¶
func StopCPUProfHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type Node ¶
Used to construct the d3 flame graph representation
func (*Node) Add ¶
Add will add a folded stack of functions to the node. Based on the stack convert node script which builds data for the d3 flame graph.
func (*Node) MarshalText ¶
MarshalText will return JSON data of the node tree in the format required by the D3 flame graph. Note that the D3 library wants arrays of children.
type Profile ¶
type Profile struct { TotalSamples uint32 // count of samples TotalFuncCalls uint32 // count of all funcs in all sample FuncFrequency map[string]uint32 UniqueFuncFrequency map[string]uint32 FuncDict map[uint64]string Prof *profile.Profile }
func EmptyProfile ¶
func NewProfile ¶
func (*Profile) ParseForD3FlameGraph ¶
The D3 Flame Graph is at: https://github.com/spiermar/d3-flame-graph
The D3 lib expects the following tree struct: 1) root --> *children 2) child --> *children
Invariant: If a Func name appears at the same stack level in two samples and the call stack prefix is also the same, then there is exactly one node at that level in the tree to denote Func.