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 ¶
- func ExtractThreadGroup(threadName string) string
- func IsSwapperThread(name string) bool
- func StackToString(stack []string) string
- func StringToStack(s string) []string
- type CPUAnalysisResult
- type CallStackEntry
- type CallStackInfo
- type FlameGraph
- type FoldedWriter
- type Generator
- type GeneratorOptions
- type GzipWriter
- type JSONWriter
- type Node
- type NodeBuilder
- type SearchResult
- type ThreadAnalysisData
- type ThreadFilter
- type ThreadFunctionInfo
- type ThreadGroupInfo
- type ThreadGroupSummary
- type ThreadInfo
- type ThreadTopFunction
- type TopFunction
- type WriteResult
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractThreadGroup ¶
ExtractThreadGroup extracts the thread group name by removing trailing numbers and separators.
func IsSwapperThread ¶
IsSwapperThread checks if the thread name indicates a swapper (idle) thread.
func StackToString ¶
StackToString converts a call stack to a semicolon-separated string.
func StringToStack ¶
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 ¶
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 NewPrettyJSONWriter ¶
func NewPrettyJSONWriter() *JSONWriter
NewPrettyJSONWriter creates a JSON writer with pretty printing.
type Node ¶
Node represents a node in the flame graph tree.
func MergeNodes ¶
MergeNodes merges multiple flame nodes into one.
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.