benchmark

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExpectedFiles = map[string]string{
	"cpu":    "cpu.out",
	"memory": "memory.out",
	"mutex":  "mutex.out",
	"block":  "block.out",
}
View Source
var ProfileFlags = map[string]string{
	"cpu":    "-cpuprofile=cpu.out",
	"memory": "-memprofile=memory.out",
	"mutex":  "-mutexprofile=mutex.out",
	"block":  "-blockprofile=block.out",
}
View Source
var SupportedProfiles = []string{"cpu", "memory", "mutex", "block"}

Functions

func DiscoverBenchmarks added in v1.7.0

func DiscoverBenchmarks(scope string) ([]string, error)

DiscoverBenchmarks scans the Go module for benchmark functions and returns their names. A benchmark is identified by functions matching:

func BenchmarkXxx(b *testing.B) { ... }

If scope is provided, only searches within that directory and its subdirectories. If scope is empty, searches the entire module from the root.

func RunBenchmarks added in v1.8.0

func RunBenchmarks(benchmarks, profiles []string, tag string, count int, groupByPackage bool) error

Types

type ProfilePaths

type ProfilePaths struct {
	// Desired file path for specified profile
	ProfileTextFile string

	// Desired bin path for specified profile
	ProfileBinaryFile string

	// Desired benchmark directory for function data collection
	FunctionDirectory string
}

ProfilePaths holds paths for profile text, binary, and output directories.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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