benchmark

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package benchmark provides TPC-H benchmarking capabilities for Porter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllQueries

func GetAllQueries() []string

GetAllQueries returns all available TPC-H query names.

func GetAvailableQueries

func GetAvailableQueries() []string

GetAvailableQueries returns the list of available TPC-H queries.

func OutputResult

func OutputResult(result *BenchmarkResult, format string, writer io.Writer) error

OutputResult writes the benchmark result in the specified format.

func ParseQueries

func ParseQueries(queryStr string) ([]string, error)

ParseQueries parses a comma-separated list of query names.

Types

type BenchmarkConfig

type BenchmarkConfig struct {
	Queries     []string      `json:"queries"`
	ScaleFactor float64       `json:"scale_factor"`
	Iterations  int           `json:"iterations"`
	Timeout     time.Duration `json:"timeout"`
	Analyze     bool          `json:"analyze"`
	Database    string        `json:"database"`
}

BenchmarkConfig holds configuration for TPC-H benchmarks.

type BenchmarkResult

type BenchmarkResult struct {
	Config      BenchmarkConfig `json:"config"`
	Results     []QueryResult   `json:"results"`
	TotalTime   time.Duration   `json:"total_time_ns"`
	StartTime   time.Time       `json:"start_time"`
	EndTime     time.Time       `json:"end_time"`
	Environment Environment     `json:"environment"`
}

BenchmarkResult represents the complete benchmark results.

type Environment

type Environment struct {
	DuckDBVersion string `json:"duckdb_version"`
	GoVersion     string `json:"go_version"`
	OS            string `json:"os"`
	Arch          string `json:"arch"`
}

Environment captures system information for benchmark results.

type QueryResult

type QueryResult struct {
	Query         string        `json:"query"`
	Iteration     int           `json:"iteration"`
	ExecutionTime time.Duration `json:"execution_time_ns"`
	RowCount      int64         `json:"row_count"`
	Error         string        `json:"error,omitempty"`
	QueryPlan     string        `json:"query_plan,omitempty"`
}

QueryResult represents the result of a single query execution.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes TPC-H benchmarks.

func NewRunner

func NewRunner(dbPath string, logger zerolog.Logger) (*Runner, error)

NewRunner creates a new benchmark runner.

func (*Runner) Close

func (r *Runner) Close() error

Close closes the database connection.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, config BenchmarkConfig) (*BenchmarkResult, error)

Run executes the benchmark with the given configuration.

Jump to

Keyboard shortcuts

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