flamegraph

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package flamegraph provides a backward-compatible wrapper for perflib/flamegraph. The generator.go file is intentionally left empty because all types and functions are now defined via type aliases in model.go, delegating to perflib/flamegraph.

Package flamegraph provides unified flame graph data structures and utilities. This package delegates to perflib/flamegraph and provides type aliases for backward compatibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractThreadGroup

func ExtractThreadGroup(threadName string) string

ExtractThreadGroup extracts the thread group name by removing trailing numbers and separators.

func IsSwapperThread

func IsSwapperThread(name string) bool

IsSwapperThread checks if the thread name indicates a swapper (idle) thread.

func StackToString

func StackToString(stack []string) string

StackToString converts a call stack to a semicolon-separated string.

func StringToStack

func StringToStack(s string) []string

StringToStack converts a semicolon-separated string back to a call stack.

Types

type CPUAnalysisResult

type CPUAnalysisResult = libfg.CPUAnalysisResult

CPUAnalysisResult holds the complete CPU profiling analysis result.

func NewCPUAnalysisResult

func NewCPUAnalysisResult() *CPUAnalysisResult

NewCPUAnalysisResult creates a new CPUAnalysisResult with initialized maps.

type CallStackEntry

type CallStackEntry = libfg.CallStackEntry

CallStackEntry represents a unique call stack.

func BuildThreadCallStacks

func BuildThreadCallStacks(callStacks map[string]int64, totalSamples int64, maxStacks int) []*CallStackEntry

BuildThreadCallStacks builds the call stacks list for a thread.

type CallStackInfo

type CallStackInfo = libfg.CallStackInfo

CallStackInfo holds call stack information for a top function.

type FlameGraph

type FlameGraph = libfg.FlameGraph

FlameGraph represents the complete flame graph structure with optional analysis data.

func GenerateFromParseResult

func GenerateFromParseResult(ctx context.Context, result *model.ParseResult) (*FlameGraph, error)

GenerateFromParseResult generates a flame graph from a parse result. This is a convenience function that creates a default generator and generates.

func NewFlameGraph

func NewFlameGraph() *FlameGraph

NewFlameGraph creates a new flame graph with a root node.

func NewFlameGraphWithAnalysis

func NewFlameGraphWithAnalysis() *FlameGraph

NewFlameGraphWithAnalysis creates a new flame graph with thread analysis support.

type FoldedWriter

type FoldedWriter = libfg.FoldedWriter

FoldedWriter writes flame graph data in collapsed/folded format.

func NewFoldedWriter

func NewFoldedWriter() *FoldedWriter

NewFoldedWriter creates a new folded format writer.

type Generator

type Generator = libfg.Generator

Generator generates flame graph data from parsed samples.

func NewGenerator

func NewGenerator(opts *GeneratorOptions) *Generator

NewGenerator creates a new flame graph generator.

type GeneratorOptions

type GeneratorOptions = libfg.GeneratorOptions

GeneratorOptions holds configuration options for the flame graph generator.

func DefaultGeneratorOptions

func DefaultGeneratorOptions() *GeneratorOptions

DefaultGeneratorOptions returns default generator options.

type GzipWriter

type GzipWriter = writer.GzipWriter[*FlameGraph]

GzipWriter writes flame graph data as gzipped JSON.

func NewGzipWriter

func NewGzipWriter() *GzipWriter

NewGzipWriter creates a new gzip writer with default compression.

func NewGzipWriterWithLevel

func NewGzipWriterWithLevel(level int) *GzipWriter

NewGzipWriterWithLevel creates a gzip writer with specified compression level.

type JSONWriter

type JSONWriter = writer.JSONWriter[*FlameGraph]

JSONWriter writes flame graph data as JSON.

func NewJSONWriter

func NewJSONWriter() *JSONWriter

NewJSONWriter creates a new JSON writer.

func NewPrettyJSONWriter

func NewPrettyJSONWriter() *JSONWriter

NewPrettyJSONWriter creates a JSON writer with pretty printing.

type Node

type Node = libfg.Node

Node represents a node in the flame graph tree.

func MergeNodes

func MergeNodes(nodes []*Node) *Node

MergeNodes merges multiple flame nodes into one.

func NewNode

func NewNode(name string, value int64) *Node

NewNode creates a new flame graph node.

func NewNodeWithMetadata

func NewNodeWithMetadata(name, module, process string, tid int, value int64) *Node

NewNodeWithMetadata creates a node with full metadata.

type NodeBuilder

type NodeBuilder = libfg.NodeBuilder

NodeBuilder helps construct flame graph trees efficiently.

func NewNodeBuilder

func NewNodeBuilder(rootName string) *NodeBuilder

NewNodeBuilder creates a new NodeBuilder.

type SearchResult

type SearchResult = libfg.SearchResult

SearchResult represents a search result for functions or threads.

type ThreadAnalysisData

type ThreadAnalysisData = libfg.ThreadAnalysisData

ThreadAnalysisData holds thread-level CPU analysis data.

type ThreadFilter

type ThreadFilter = libfg.ThreadFilter

ThreadFilter defines criteria for filtering threads.

type ThreadFunctionInfo

type ThreadFunctionInfo = libfg.ThreadFunctionInfo

ThreadFunctionInfo shows function statistics per thread.

type ThreadGroupInfo

type ThreadGroupInfo = libfg.ThreadGroupInfo

ThreadGroupInfo provides aggregated statistics for a thread group.

type ThreadGroupSummary

type ThreadGroupSummary = libfg.ThreadGroupSummary

ThreadGroupSummary provides aggregated statistics for a thread group.

type ThreadInfo

type ThreadInfo = libfg.ThreadInfo

ThreadInfo represents detailed CPU analysis for a single thread.

type ThreadTopFunction

type ThreadTopFunction = libfg.ThreadTopFunction

ThreadTopFunction represents a hot function within a thread.

func BuildThreadTopFunctions

func BuildThreadTopFunctions(funcCounts map[string]int64, totalSamples int64, topN int) []*ThreadTopFunction

BuildThreadTopFunctions builds the top functions list for a thread.

type TopFunction

type TopFunction = libfg.TopFunction

TopFunction represents a globally hot function across all threads.

type WriteResult

type WriteResult = writer.WriteResult

WriteResult is an alias to the common writer.WriteResult.

type Writer

type Writer interface {
	Write(fg *FlameGraph, w io.Writer) error
}

Writer defines the interface for writing flame graph output.

Jump to

Keyboard shortcuts

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