Documentation
¶
Index ¶
- type BenchmarkResult
- type MemoryDelta
- type Metric
- type MetricType
- type ObjectPool
- type OperationStats
- type OperationSummary
- type OptimizationLevel
- type Optimizer
- type Profiler
- func (p *Profiler) CaptureMemoryStats() runtime.MemStats
- func (p *Profiler) FindMemoryLeaks() []string
- func (p *Profiler) GetMemoryDelta() MemoryDelta
- func (p *Profiler) GetOperationStats() map[string]OperationSummary
- func (p *Profiler) Report() string
- func (p *Profiler) StartOperation(name string) func()
- type Recommendation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BenchmarkResult ¶
type BenchmarkResult struct {
Name string
Iterations int
TotalTime time.Duration
TimePerOp time.Duration
AllocsPerOp int64
BytesPerOp int64
}
BenchmarkResult contains benchmark results
func BenchmarkOperation ¶
func BenchmarkOperation(name string, iterations int, operation func()) BenchmarkResult
BenchmarkOperation runs a benchmark on an operation
func (BenchmarkResult) String ¶
func (r BenchmarkResult) String() string
String returns a string representation of benchmark result
type MemoryDelta ¶
type MemoryDelta struct {
HeapAllocDelta int64
HeapObjectsDelta int64
GoroutinesDelta int
GCCycles uint32
}
MemoryDelta represents memory changes
type MetricType ¶
type MetricType string
MetricType represents different types of metrics
const ( MetricCPU MetricType = "cpu" MetricMemory MetricType = "memory" MetricGoroutine MetricType = "goroutine" MetricLatency MetricType = "latency" )
type ObjectPool ¶
type ObjectPool[T any] struct { // contains filtered or unexported fields }
ObjectPool provides a generic object pool for reducing allocations
func NewObjectPool ¶
func NewObjectPool[T any](new func() T) *ObjectPool[T]
NewObjectPool creates a new object pool
type OperationStats ¶
type OperationStats struct {
Name string
Count int64
TotalTime time.Duration
MinTime time.Duration
MaxTime time.Duration
LastTime time.Duration
// contains filtered or unexported fields
}
OperationStats tracks statistics for a specific operation
type OperationSummary ¶
type OperationSummary struct {
Name string
Count int64
TotalTime time.Duration
AverageTime time.Duration
MinTime time.Duration
MaxTime time.Duration
LastTime time.Duration
}
OperationSummary provides a summary of operation statistics
type OptimizationLevel ¶
type OptimizationLevel int
OptimizationLevel represents the level of optimization
const ( OptimizationNone OptimizationLevel = iota OptimizationLight OptimizationModerate OptimizationAggressive )
type Optimizer ¶
type Optimizer struct {
// contains filtered or unexported fields
}
Optimizer provides performance optimization recommendations and automatic tuning
func NewOptimizer ¶
NewOptimizer creates a new performance optimizer
func (*Optimizer) Analyze ¶
func (o *Optimizer) Analyze() []Recommendation
Analyze performs performance analysis and generates recommendations
func (*Optimizer) EnableAutoTune ¶
EnableAutoTune enables automatic performance tuning
func (*Optimizer) GetOptimizationSummary ¶
GetOptimizationSummary returns a summary of optimizations
func (*Optimizer) SetLevel ¶
func (o *Optimizer) SetLevel(level OptimizationLevel)
SetLevel sets the optimization level
func (*Optimizer) TuneForBatchOperations ¶
func (o *Optimizer) TuneForBatchOperations()
TuneForBatchOperations optimizes settings for batch operations
func (*Optimizer) TuneForInteractive ¶
func (o *Optimizer) TuneForInteractive()
TuneForInteractive optimizes settings for interactive use
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
Profiler handles performance profiling
func (*Profiler) CaptureMemoryStats ¶
CaptureMemoryStats captures current memory statistics
func (*Profiler) FindMemoryLeaks ¶
FindMemoryLeaks looks for potential memory leaks
func (*Profiler) GetMemoryDelta ¶
func (p *Profiler) GetMemoryDelta() MemoryDelta
GetMemoryDelta returns memory changes since baseline
func (*Profiler) GetOperationStats ¶
func (p *Profiler) GetOperationStats() map[string]OperationSummary
GetOperationStats returns statistics for all operations
func (*Profiler) StartOperation ¶
StartOperation starts timing an operation