Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparisonTable ¶
func ComparisonTable(results []*BenchmarkResult) string
ComparisonTable generates a markdown comparison table from benchmark results.
func PrintResult ¶
func PrintResult(r *BenchmarkResult)
PrintResult prints a formatted benchmark result to stdout.
func SaveResults ¶
func SaveResults(results []*BenchmarkResult, path string) error
SaveResults saves benchmark results to a JSON file.
Types ¶
type Benchmark ¶
type Benchmark struct {
// contains filtered or unexported fields
}
Benchmark runs performance comparisons and generates formatted results. Measures requests/sec, latency percentiles, bytes transferred, and error rates.
func NewBenchmark ¶
NewBenchmark creates a new benchmark runner.
func (*Benchmark) Run ¶
func (b *Benchmark) Run(cfg *BenchmarkConfig) *BenchmarkResult
Run executes a benchmark with the given configuration.
type BenchmarkConfig ¶
type BenchmarkConfig struct {
URL string
Concurrency int
Duration time.Duration
Requests int
Headers map[string]string
}
BenchmarkConfig configures a benchmark run.
func DefaultBenchmarkConfig ¶
func DefaultBenchmarkConfig(url string) *BenchmarkConfig
DefaultBenchmarkConfig returns a sensible default configuration.
type BenchmarkResult ¶
type BenchmarkResult struct {
Tool string `json:"tool"`
URL string `json:"url"`
Concurrency int `json:"concurrency"`
Duration time.Duration `json:"duration"`
TotalReqs int64 `json:"total_requests"`
SuccessReqs int64 `json:"success_requests"`
FailedReqs int64 `json:"failed_requests"`
ReqsPerSec float64 `json:"requests_per_second"`
AvgLatency time.Duration `json:"avg_latency"`
P50Latency time.Duration `json:"p50_latency"`
P95Latency time.Duration `json:"p95_latency"`
P99Latency time.Duration `json:"p99_latency"`
MinLatency time.Duration `json:"min_latency"`
MaxLatency time.Duration `json:"max_latency"`
BytesRecv int64 `json:"bytes_received"`
Throughput float64 `json:"throughput_mbps"`
ErrorRate float64 `json:"error_rate"`
}
BenchmarkResult holds the results of a benchmark run.
Click to show internal directories.
Click to hide internal directories.