Documentation
¶
Index ¶
- type BenchmarkMetrics
- func (bm *BenchmarkMetrics) Finish(totalBytes int64)
- func (bm *BenchmarkMetrics) GetResults() BenchmarkResults
- func (bm *BenchmarkMetrics) RecordBytes(n int64)
- func (bm *BenchmarkMetrics) RecordConnections(count int32)
- func (bm *BenchmarkMetrics) RecordFirstByte()
- func (bm *BenchmarkMetrics) RecordRetry()
- type BenchmarkResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BenchmarkMetrics ¶
type BenchmarkMetrics struct {
StartTime time.Time
FirstByteTime time.Time
EndTime time.Time
TotalBytes int64
BytesReceived atomic.Int64
RetryCount atomic.Int32
ConnectionMax atomic.Int32
ConnectionSum atomic.Int64
SampleCount atomic.Int64
// Memory tracking
StartMemAlloc uint64
PeakMemAlloc uint64
}
BenchmarkMetrics collects performance metrics during download
func NewBenchmarkMetrics ¶
func NewBenchmarkMetrics() *BenchmarkMetrics
NewBenchmarkMetrics creates a new metrics collector
func (*BenchmarkMetrics) Finish ¶
func (bm *BenchmarkMetrics) Finish(totalBytes int64)
Finish marks the download as complete and captures final stats
func (*BenchmarkMetrics) GetResults ¶
func (bm *BenchmarkMetrics) GetResults() BenchmarkResults
GetResults returns the computed metrics
func (*BenchmarkMetrics) RecordBytes ¶
func (bm *BenchmarkMetrics) RecordBytes(n int64)
RecordBytes adds to the total bytes received
func (*BenchmarkMetrics) RecordConnections ¶
func (bm *BenchmarkMetrics) RecordConnections(count int32)
RecordConnections samples the current connection count
func (*BenchmarkMetrics) RecordFirstByte ¶
func (bm *BenchmarkMetrics) RecordFirstByte()
RecordFirstByte marks when the first byte was received
func (*BenchmarkMetrics) RecordRetry ¶
func (bm *BenchmarkMetrics) RecordRetry()
RecordRetry increments the retry counter
type BenchmarkResults ¶
type BenchmarkResults struct {
TotalTime time.Duration
TTFB time.Duration
ThroughputMBps float64
TotalBytes int64
RetryCount int
MaxConnections int
AvgConnections float64
MemoryUsedMB float64
}
BenchmarkResults holds the final computed metrics
func (BenchmarkResults) String ¶
func (br BenchmarkResults) String() string
String returns a formatted summary of the results
Click to show internal directories.
Click to hide internal directories.