analysis

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionStat

type FunctionStat struct {
	Function   string
	Percentage float64
}

FunctionStat describes one function's flat contribution to a profile.

type ProfileAnalysis

type ProfileAnalysis struct {
	Type      ProfileType
	Functions []FunctionStat
}

ProfileAnalysis contains the ranked functions for one collected profile.

func AnalyzeProfiles

func AnalyzeProfiles(profiles []*profile.CollectedProfile, limit int) ([]ProfileAnalysis, error)

AnalyzeProfiles returns deterministic, ranked function summaries for the collected profiles. A limit of zero disables analysis.

type ProfileType

type ProfileType string

ProfileType maps to pprof profile types for threshold evaluation.

const (
	CPU       ProfileType = "cpu"
	Alloc     ProfileType = "alloc"
	Block     ProfileType = "block"
	Goroutine ProfileType = "goroutine"
)

type Threshold

type Threshold struct {
	Type       ProfileType
	Percentage float64
}

Threshold defines a pass/fail gate for a profile type.

func ParseThresholds

func ParseThresholds(s string) ([]Threshold, error)

ParseThresholds parses a comma-separated threshold string like "cpu:30,alloc:50".

type Violation

type Violation struct {
	Function   string
	Percentage float64
	Threshold  Threshold
}

Violation records a function that exceeded its threshold.

func CheckThresholds

func CheckThresholds(profiles []*profile.CollectedProfile, thresholds []Threshold) ([]Violation, error)

CheckThresholds evaluates collected profiles against thresholds. Returns violations for functions exceeding their threshold.

Jump to

Keyboard shortcuts

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