Documentation
¶
Index ¶
- Constants
- func CleanOrCreateTag(dir string) error
- func CreateTemplate() error
- func FindGoModuleRoot() (string, error)
- func GetScanner(filePath string) (*bufio.Scanner, *os.File, error)
- func PrintConfiguration(benchArgs *BenchArgs, functionFilterPerBench map[string]FunctionFilter)
- type BenchArgs
- type CIConfig
- type CITrackingConfig
- type CollectionArgs
- type Config
- type FunctionFilter
- type LineFilterArgs
Constants ¶
const ( AUTOCMD = "auto" MANUALCMD = "manual" TrackAutoCMD = AUTOCMD TrackManualCMD = MANUALCMD )
const ( InfoCollectionSuccess = "All benchmarks and profile processing completed successfully!" IMPROVEMENT = "IMPROVEMENT" REGRESSION = "REGRESSION" STABLE = "STABLE" )
const ( MainDirOutput = "bench" ProfileTextDir = "text" ToolDir = "tools" ProfileBinDir = "bin" PermDir = 0o755 PermFile = 0o644 FunctionsDirSuffix = "_functions" ToolsResultsSuffix = "_results.txt" TextExtension = "txt" ConfigFilename = "config_template.json" GlobalSign = "*" ExpectedTestSuffix = ".test" )
Variables ¶
This section is empty.
Functions ¶
func CleanOrCreateTag ¶
CleanOrCreateTag cleans the tag directory if it exists, or creates one.
func CreateTemplate ¶
func CreateTemplate() error
CreateTemplate creates a template configuration file from the actual Config struct with pre-built examples.
func FindGoModuleRoot ¶
FindGoModuleRoot searches upwards from the current working directory for a directory containing a go.mod file and returns its absolute path. If none is found, an error is returned.
func PrintConfiguration ¶
func PrintConfiguration(benchArgs *BenchArgs, functionFilterPerBench map[string]FunctionFilter)
Types ¶
type CIConfig ¶
type CIConfig struct {
// Global CI/CD settings that apply to all tracking operations
Global *CITrackingConfig `json:"global,omitempty"`
// Benchmark-specific CI/CD settings
Benchmarks map[string]CITrackingConfig `json:"benchmarks,omitempty"`
}
CIConfig holds CI/CD specific configuration for performance tracking
type CITrackingConfig ¶
type CITrackingConfig struct {
// Functions to ignore during performance comparison (reduces noise)
// These functions won't cause CI/CD failures even if they regress
IgnoreFunctions []string `json:"ignore_functions,omitempty"`
// Function prefixes to ignore during performance comparison
// Example: ["runtime.", "reflect."] ignores all runtime and reflect functions
IgnorePrefixes []string `json:"ignore_prefixes,omitempty"`
// Minimum change threshold for CI/CD failure
// Only functions with changes >= this threshold will cause failures
MinChangeThreshold float64 `json:"min_change_threshold,omitempty"`
// Maximum acceptable regression percentage for CI/CD
// Overrides command-line regression threshold if set
MaxRegressionThreshold float64 `json:"max_regression_threshold,omitempty"`
// Whether to fail on improvements (useful for detecting unexpected optimizations)
FailOnImprovement bool `json:"fail_on_improvement,omitempty"`
}
CITrackingConfig defines CI/CD specific filtering for performance tracking
type CollectionArgs ¶
type CollectionArgs struct {
Tag string
Profiles []string
BenchmarkName string
BenchmarkConfig FunctionFilter
}
type Config ¶
type Config struct {
FunctionFilter map[string]FunctionFilter `json:"function_collection_filter"`
// CI/CD specific configuration for performance tracking
CIConfig *CIConfig `json:"ci_config,omitempty"`
}
Config holds the main configuration for the prof tool.
func LoadFromFile ¶
LoadFromFile loads and validates config from a JSON file.
type FunctionFilter ¶
type FunctionFilter struct {
// Prefixes: only collect functions starting with these prefixes
// Example: []string{"github.com/example/GenPool"}
IncludePrefixes []string `json:"include_prefixes,omitempty"`
// IgnoreFunctions ignores the function name after the last dot.
// Example: "Get,Set" excludes pool.Get() and cache.Set()
IgnoreFunctions []string `json:"ignore_functions,omitempty"`
}
FunctionCollectionFilter defines filters for a specific benchmark, the filters are used when deciding which functions to collect code line level information for.