flamegraph

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStackWithNumbers

func FormatStackWithNumbers(stack []string) string

FormatStackWithNumbers adds numbering to each frame in the stack

Types

type Direction

type Direction int

Direction defines the drawing direction of the flamegraph.

const (
	// DirectionTopDown draws from top to bottom (root at top)
	DirectionTopDown Direction = iota
	// DirectionBottomUp draws from bottom to top (root at bottom)
	DirectionBottomUp
)

type FlameView

type FlameView struct {
	*tview.Box
	// contains filtered or unexported fields
}

FlameView is a custom tview widget for drawing flamegraphs.

func NewFlamegraphView

func NewFlamegraphView() *FlameView

NewFlamegraphView creates a new instance of the flamegraph widget. Default direction is top-down.

func (*FlameView) BuildFromRows

func (f *FlameView) BuildFromRows(rows *sql.Rows) error

BuildFromRows builds the flamegraph tree directly from database rows. This avoids the need to write to and read from temporary files.

func (*FlameView) Draw

func (f *FlameView) Draw(screen tcell.Screen)

Draw renders the flamegraph widget on the screen.

func (*FlameView) GetTotalCount

func (f *FlameView) GetTotalCount() int

func (*FlameView) SetData

func (f *FlameView) SetData(data string)

SetData accepts the raw flamegraph data as a string.

func (*FlameView) SetDirection

func (f *FlameView) SetDirection(d Direction)

SetDirection sets the drawing direction of the flamegraph.

func (*FlameView) SetFrameHandler

func (f *FlameView) SetFrameHandler(handler FrameHandler)

SetFrameHandler sets the handler function for frame selection events.

func (*FlameView) SetPageSwitcher

func (f *FlameView) SetPageSwitcher(switcher PageSwitcherFunc)

SetPageSwitcher sets the function that will be called to switch pages

func (*FlameView) SetSourcePage

func (f *FlameView) SetSourcePage(sourcePage string)

SetSourcePage sets the name of the page that opened this flamegraph

type FocusedFrame

type FocusedFrame struct {
	// contains filtered or unexported fields
}

FocusedFrame represents a frame that currently has focus.

type Frame

type Frame struct {
	Name     string
	Count    int
	Parent   *Frame
	Children []*Frame
}

Frame represents a node in the flamegraph.

func (*Frame) AddStack

func (f *Frame) AddStack(stack []string, count int)

AddStack inserts a stack of frames into the tree, accumulating the count.

type FrameHandler

type FrameHandler func(stack []string, count int, selectedLevel int)

FrameHandler is a function that handles frame selection events. It receives the full stack trace from root to the selected frame, the count, and the level/position of the selected frame in the stack (0-based index).

type PageSwitcherFunc

type PageSwitcherFunc func(targetPage string)

PageSwitcherFunc is a function that switches to a specified page

Jump to

Keyboard shortcuts

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