Documentation
¶
Index ¶
- func BuildStaticBinary(outputPath string) error
- func ExtractRepoName(repoURL string) string
- func ParseIntList(str string) ([]int, error)
- func PrintAllGraphs(result *MatrixResult)
- func PrintBuildTimeGraph(result *MatrixResult)
- func PrintSummaryTable(result *MatrixResult)
- func SaveSummaryCSV(result *MatrixResult, filename string) error
- func SaveSummaryJSON(result *MatrixResult, filename string) error
- func SaveSummaryMarkdown(result *MatrixResult, filename string) error
- type BenchmarkType
- type Config
- type ConfigResult
- type Container
- func (c *Container) CopyDirFromContainer(ctx context.Context, srcPath, dstPath string) error
- func (c *Container) CopyFileFromContainer(ctx context.Context, srcPath, dstPath string) error
- func (c *Container) CopyFileToContainer(ctx context.Context, srcPath, dstPath string) error
- func (c *Container) CopyFileToContainerWithDebug(ctx context.Context, srcPath, dstPath string, debug bool) error
- func (c *Container) Exec(ctx context.Context, cmd []string, workDir string) (*ExecResult, error)
- func (c *Container) ExecShell(ctx context.Context, command string, workDir string) (*ExecResult, error)
- func (c *Container) ExecShellStreaming(ctx context.Context, command string, workDir string, debug bool) (*ExecResult, error)
- func (c *Container) ExecShellWithDebug(ctx context.Context, command string, workDir string, debug bool) (*ExecResult, error)
- func (c *Container) Stop(ctx context.Context) error
- type ContainerConfig
- type DockerClient
- func (d *DockerClient) Close() error
- func (d *DockerClient) CreateContainer(ctx context.Context, cfg ContainerConfig) (*Container, error)
- func (d *DockerClient) CreateContainerWithDebug(ctx context.Context, cfg ContainerConfig, debug bool) (*Container, error)
- func (d *DockerClient) EnsureImage(ctx context.Context, imageName string) error
- type ExecResult
- type MatrixResult
- type ResourceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildStaticBinary ¶
BuildStaticBinary builds a static binary for Linux that can run in Docker containers
func ExtractRepoName ¶
ExtractRepoName extracts the repository name from a URL
func ParseIntList ¶ added in v0.1.2
ParseIntList parses a comma-separated string of integers like "2,4,8,16" into []int
func PrintAllGraphs ¶ added in v0.1.2
func PrintAllGraphs(result *MatrixResult)
PrintAllGraphs prints multiple graphs for "all" benchmark mode One graph per RAM value showing CPU scaling, and one graph per CPU value showing RAM scaling
func PrintBuildTimeGraph ¶
func PrintBuildTimeGraph(result *MatrixResult)
PrintBuildTimeGraph prints an ASCII bar chart of build time based on benchmark type
func PrintSummaryTable ¶
func PrintSummaryTable(result *MatrixResult)
PrintSummaryTable prints a formatted summary table to the console
func SaveSummaryCSV ¶
func SaveSummaryCSV(result *MatrixResult, filename string) error
SaveSummaryCSV saves the matrix results as CSV
func SaveSummaryJSON ¶
func SaveSummaryJSON(result *MatrixResult, filename string) error
SaveSummaryJSON saves the matrix results as JSON
func SaveSummaryMarkdown ¶
func SaveSummaryMarkdown(result *MatrixResult, filename string) error
SaveSummaryMarkdown saves the matrix results as Markdown
Types ¶
type BenchmarkType ¶ added in v0.1.2
type BenchmarkType string
BenchmarkType represents the type of matrix benchmark being run
const ( BenchmarkTypeCustom BenchmarkType = "custom" BenchmarkTypeSweepCPU BenchmarkType = "sweep-cpu" BenchmarkTypeSweepRAM BenchmarkType = "sweep-ram" BenchmarkTypeAll BenchmarkType = "all" )
type Config ¶
type Config struct {
Image string // Docker image name
RepoURL string // Git repository URL to clone
Command string // Benchmark command to run
Runs int // Number of benchmark runs per configuration
OutputDir string // Directory to save output files
Name string // Benchmark name for reports
Configs []ResourceConfig // CPU/RAM configurations to test
SkipWarmup bool // Skip warm-up run
Debug bool // Enable debug logging with real-time output
Type BenchmarkType // Type of benchmark (custom, sweep-cpu, sweep-ram, all)
FixedCPU int // For sweep-ram: the fixed CPU value
FixedRAM int // For sweep-cpu: the fixed RAM value
CPUList []int // For all: list of CPU values tested
RAMList []int // For all: list of RAM values tested
}
Config holds the matrix benchmark configuration
type ConfigResult ¶
type ConfigResult struct {
Config ResourceConfig
Success bool
Error string
Mean float64 // Mean duration in seconds
Median float64 // Median duration in seconds
StdDev float64 // Standard deviation in seconds
Min float64 // Minimum duration in seconds
Max float64 // Maximum duration in seconds
P90 float64 // 90th percentile in seconds
P95 float64 // 95th percentile in seconds
SuccessRate float64 // Percentage of successful runs
TotalRuns int // Total number of runs attempted
SuccessRuns int // Number of successful runs
}
ConfigResult holds the result for a single configuration
type Container ¶
type Container struct {
ID string
// contains filtered or unexported fields
}
Container represents a running Docker container
func (*Container) CopyDirFromContainer ¶
CopyDirFromContainer copies a directory from the container to the host
func (*Container) CopyFileFromContainer ¶
CopyFileFromContainer copies a file from the container to the host
func (*Container) CopyFileToContainer ¶
CopyFileToContainer copies a file from the host to the container
func (*Container) CopyFileToContainerWithDebug ¶
func (c *Container) CopyFileToContainerWithDebug(ctx context.Context, srcPath, dstPath string, debug bool) error
CopyFileToContainerWithDebug copies a file from the host to the container with optional debug logging
func (*Container) ExecShell ¶
func (c *Container) ExecShell(ctx context.Context, command string, workDir string) (*ExecResult, error)
ExecShell executes a shell command in the container
func (*Container) ExecShellStreaming ¶
func (c *Container) ExecShellStreaming(ctx context.Context, command string, workDir string, debug bool) (*ExecResult, error)
ExecShellStreaming executes a shell command in the container with real-time output streaming
func (*Container) ExecShellWithDebug ¶
func (c *Container) ExecShellWithDebug(ctx context.Context, command string, workDir string, debug bool) (*ExecResult, error)
ExecShellWithDebug executes a shell command with optional debug logging (non-streaming)
type ContainerConfig ¶
type ContainerConfig struct {
Image string
CPUs int
Memory int // GB
WorkingDir string
MountPath string // Host path to mount at /workspace
}
ContainerConfig holds configuration for creating a container
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps the Docker SDK client
func NewDockerClient ¶
func NewDockerClient() (*DockerClient, error)
NewDockerClient creates a new Docker client
func (*DockerClient) CreateContainer ¶
func (d *DockerClient) CreateContainer(ctx context.Context, cfg ContainerConfig) (*Container, error)
CreateContainer creates and starts a new container with resource limits
func (*DockerClient) CreateContainerWithDebug ¶
func (d *DockerClient) CreateContainerWithDebug(ctx context.Context, cfg ContainerConfig, debug bool) (*Container, error)
CreateContainerWithDebug creates and starts a new container with resource limits and optional debug logging
func (*DockerClient) EnsureImage ¶
func (d *DockerClient) EnsureImage(ctx context.Context, imageName string) error
EnsureImage checks if the image exists locally, pulls if not
type ExecResult ¶
ExecResult holds the result of executing a command in a container
type MatrixResult ¶
type MatrixResult struct {
Config Config
Results []ConfigResult
}
MatrixResult holds the complete matrix benchmark results
type ResourceConfig ¶
ResourceConfig represents a single CPU/RAM configuration
func GenerateGridConfigs ¶ added in v0.1.2
func GenerateGridConfigs(cpus []int, rams []int) []ResourceConfig
GenerateGridConfigs creates configs for all CPU x RAM combinations Ordered by CPU first, then RAM (e.g., 2:8, 2:16, 2:32, 4:8, 4:16, ...)
func GenerateSweepCPUConfigs ¶ added in v0.1.2
func GenerateSweepCPUConfigs(cpus []int, fixedRAM int) []ResourceConfig
GenerateSweepCPUConfigs creates configs with varying CPUs and fixed RAM
func GenerateSweepRAMConfigs ¶ added in v0.1.2
func GenerateSweepRAMConfigs(rams []int, fixedCPU int) []ResourceConfig
GenerateSweepRAMConfigs creates configs with varying RAM and fixed CPU
func ParseConfigs ¶
func ParseConfigs(configStr string) ([]ResourceConfig, error)
ParseConfigs parses a config string like "2:8,4:16,8:32" into ResourceConfig slice
func (ResourceConfig) DirName ¶
func (r ResourceConfig) DirName() string
DirName returns a directory-safe name for the config
func (ResourceConfig) String ¶
func (r ResourceConfig) String() string
String returns a human-readable representation of the config