Documentation
¶
Overview ¶
Package perflib provides reusable performance analysis engine components.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger defines the logging interface for perflib. Consumers inject their own Logger implementation (e.g., slog adapter, zap, logrus).
This is a minimal interface covering only the methods used by perflib internals. Any logger with these four methods automatically satisfies this interface.
type PhaseTimer ¶
type PhaseTimer interface {
// Stop stops the phase timer and returns its duration.
// Safe to call multiple times; only the first call has effect.
Stop() time.Duration
}
PhaseTimer controls a single timing phase. It supports automatic completion via defer: defer pt.Stop()
type Timer ¶
type Timer interface {
// Start starts timing a new phase. Returns a PhaseTimer for stopping.
Start(phaseName string) PhaseTimer
// TimeFunc times the execution of a function and records it as a phase.
TimeFunc(phaseName string, fn func()) time.Duration
// TimeFuncWithError times a function that may return an error.
TimeFuncWithError(phaseName string, fn func() error) (time.Duration, error)
// PrintSummary outputs the timing summary using the configured output strategy.
PrintSummary()
}
Timer defines the performance timing interface for perflib. Consumers inject their own Timer implementation for phase-level profiling.
This interface covers the methods used by perflib internals (hprof parser, etc.). If nil is provided where a Timer is expected, NullTimer should be used instead.
var NullTimer Timer = &nullTimer{}
NullTimer is a no-op timer for when timing is disabled. All methods are safe to call but do nothing.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package analyzer provides profiling data analysis implementations.
|
Package analyzer provides profiling data analysis implementations. |
|
Package callgraph provides utilities for generating call graph data.
|
Package callgraph provides utilities for generating call graph data. |
|
Package flamegraph provides unified flame graph data structures and utilities.
|
Package flamegraph provides unified flame graph data structures and utilities. |
|
internal
|
|
|
collections
Package collections provides generic data structures for efficient data processing.
|
Package collections provides generic data structures for efficient data processing. |
|
compression
Package compression provides unified compression/decompression utilities.
|
Package compression provides unified compression/decompression utilities. |
|
filter
Package filter provides unified class name filtering logic for heap analysis.
|
Package filter provides unified class name filtering logic for heap analysis. |
|
parallel
Package parallel provides generic parallel processing utilities.
|
Package parallel provides generic parallel processing utilities. |
|
timer
Package timer provides a concrete Timer implementation that satisfies perflib.Timer.
|
Package timer provides a concrete Timer implementation that satisfies perflib.Timer. |
|
Package model defines output data abstractions for different analysis types.
|
Package model defines output data abstractions for different analysis types. |
|
Package parser defines the interfaces for parsing profiling data.
|
Package parser defines the interfaces for parsing profiling data. |
|
collapsed
Package collapsed implements parsing of collapsed stack format data.
|
Package collapsed implements parsing of collapsed stack format data. |
|
hprof
Package hprof provides parsing functionality for Java HPROF heap dump files.
|
Package hprof provides parsing functionality for Java HPROF heap dump files. |
|
pprof
Package pprof provides parsing functionality for Go pprof profile data.
|
Package pprof provides parsing functionality for Go pprof profile data. |
|
Package profiling provides common utilities for profiling data analysis.
|
Package profiling provides common utilities for profiling data analysis. |
|
Package statistics provides utilities for calculating profiling statistics.
|
Package statistics provides utilities for calculating profiling statistics. |
|
Package writer provides common JSON and Gzip writers for profiling data.
|
Package writer provides common JSON and Gzip writers for profiling data. |