benchmark

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkConcurrentScans2

func BenchmarkConcurrentScans2(b *testing.B)

BenchmarkConcurrentScans2 tests concurrent scanning performance

func BenchmarkLargePackage

func BenchmarkLargePackage(b *testing.B)

BenchmarkLargePackage tests performance with large packages (50+ dependencies)

func BenchmarkMLAnalysis

func BenchmarkMLAnalysis(b *testing.B)

BenchmarkMLAnalysis tests ML analysis performance

func BenchmarkMediumPackage

func BenchmarkMediumPackage(b *testing.B)

BenchmarkMediumPackage tests performance with medium packages (10-50 dependencies)

func BenchmarkMemoryUsage2

func BenchmarkMemoryUsage2(b *testing.B)

BenchmarkMemoryUsage2 tests memory usage patterns

func BenchmarkSmallPackage

func BenchmarkSmallPackage(b *testing.B)

BenchmarkSmallPackage tests performance with small packages (1-10 dependencies)

func BenchmarkStressTest

func BenchmarkStressTest(b *testing.B)

BenchmarkStressTest performs stress testing with high concurrency

func BenchmarkThroughput

func BenchmarkThroughput(b *testing.B)

BenchmarkThroughput tests scanning throughput

Types

type BenchmarkMetrics

type BenchmarkMetrics struct {
	Duration     time.Duration `json:"duration"`
	Operations   int           `json:"operations"`
	OpsPerSecond float64       `json:"ops_per_second"`
	AvgTimePerOp time.Duration `json:"avg_time_per_op"`
	MemoryPerOp  uint64        `json:"memory_per_op"`
	AllocsPerOp  uint64        `json:"allocs_per_op"`
	MinTime      time.Duration `json:"min_time,omitempty"`
	MaxTime      time.Duration `json:"max_time,omitempty"`
	StdDev       time.Duration `json:"std_dev,omitempty"`
	ErrorRate    float64       `json:"error_rate,omitempty"`
	ThroughputMB float64       `json:"throughput_mb,omitempty"`
}

BenchmarkMetrics holds performance metrics for a single benchmark

type BenchmarkResults

type BenchmarkResults struct {
	Timestamp   time.Time                   `json:"timestamp"`
	Environment EnvironmentInfo             `json:"environment"`
	Metrics     map[string]BenchmarkMetrics `json:"metrics"`
}

BenchmarkResults holds the complete results of a benchmark run

type BenchmarkSuite

type BenchmarkSuite struct {
	Duration       time.Duration
	Parallel       int
	Iterations     int
	WarmupDuration time.Duration
	Verbose        bool
	Config         *config.Config

	Name        string                      `json:"name"`
	Description string                      `json:"description"`
	Results     map[string]BenchmarkMetrics `json:"results"`
	Timestamp   time.Time                   `json:"timestamp"`
	Environment EnvironmentInfo             `json:"environment"`
	// contains filtered or unexported fields
}

BenchmarkSuite manages and executes performance benchmarks

func NewBenchmarkSuite

func NewBenchmarkSuite() *BenchmarkSuite

NewBenchmarkSuite creates a new benchmark suite

func RunBenchmarkSuite

func RunBenchmarkSuite() (*BenchmarkSuite, error)

RunBenchmarkSuite executes a comprehensive benchmark suite

type EnvironmentInfo

type EnvironmentInfo struct {
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	CPUs      int    `json:"cpus"`
	GoVersion string `json:"go_version"`
	MemoryMB  int64  `json:"memory_mb"`
	Hostname  string `json:"hostname"`
}

EnvironmentInfo captures system information

func GetEnvironmentInfo

func GetEnvironmentInfo() EnvironmentInfo

GetEnvironmentInfo collects system information for benchmark context

Jump to

Keyboard shortcuts

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