Documentation
¶
Index ¶
- Variables
- type BenchmarkResource
- type BenchmarkRunner
- type DebugDbResource
- func (r *DebugDbResource) GetMux() srpc.Invoker
- func (r *DebugDbResource) GetStorageInfo(_ context.Context, _ *s4wave_debugdb.GetStorageInfoRequest) (*s4wave_debugdb.GetStorageInfoResponse, error)
- func (r *DebugDbResource) StartBenchmark(ctx context.Context, req *s4wave_debugdb.StartBenchmarkRequest) (*s4wave_debugdb.StartBenchmarkResponse, error)
- type MetricCollector
- type SuiteTimer
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("storage benchmarks only available in browser")
ErrNotSupported is returned when benchmarking is not available.
Functions ¶
This section is empty.
Types ¶
type BenchmarkResource ¶
type BenchmarkResource struct {
// contains filtered or unexported fields
}
BenchmarkResource wraps a BenchmarkRunner as a DebugDbBenchmarkService resource.
func NewBenchmarkResource ¶
func NewBenchmarkResource(le *logrus.Entry, runner *BenchmarkRunner) *BenchmarkResource
NewBenchmarkResource creates a new BenchmarkResource.
func (*BenchmarkResource) GetMux ¶
func (r *BenchmarkResource) GetMux() srpc.Invoker
GetMux returns the rpc mux.
func (*BenchmarkResource) GetResults ¶
func (r *BenchmarkResource) GetResults( ctx context.Context, _ *s4wave_debugdb.GetResultsRequest, ) (*s4wave_debugdb.GetResultsResponse, error)
GetResults returns the full benchmark results after completion.
func (*BenchmarkResource) WatchProgress ¶
func (r *BenchmarkResource) WatchProgress( _ *s4wave_debugdb.WatchProgressRequest, strm s4wave_debugdb.SRPCDebugDbBenchmarkService_WatchProgressStream, ) error
WatchProgress streams benchmark progress updates.
type BenchmarkRunner ¶
type BenchmarkRunner struct {
// contains filtered or unexported fields
}
BenchmarkRunner executes storage benchmark suites. On non-WASM platforms this is a stub that returns an error.
func NewBenchmarkRunner ¶
func NewBenchmarkRunner( _ *logrus.Entry, _ *s4wave_debugdb.BenchmarkConfig, _ *s4wave_debugdb.StorageInfo, ) *BenchmarkRunner
NewBenchmarkRunner creates a new benchmark runner.
func (*BenchmarkRunner) GetResults ¶
func (r *BenchmarkRunner) GetResults(ctx context.Context) (*s4wave_debugdb.BenchmarkResults, error)
GetResults returns an error on non-WASM platforms.
func (*BenchmarkRunner) Run ¶
func (r *BenchmarkRunner) Run(_ context.Context)
Run is a no-op on non-WASM platforms.
func (*BenchmarkRunner) WatchProgress ¶
func (r *BenchmarkRunner) WatchProgress() (s4wave_debugdb.WatchProgressResponse, <-chan struct{})
WatchProgress returns the current progress.
type DebugDbResource ¶
type DebugDbResource struct {
// contains filtered or unexported fields
}
DebugDbResource implements the DebugDbResourceService.
func NewDebugDbResource ¶
func NewDebugDbResource(le *logrus.Entry, b bus.Bus) *DebugDbResource
NewDebugDbResource creates a new DebugDbResource.
func (*DebugDbResource) GetMux ¶
func (r *DebugDbResource) GetMux() srpc.Invoker
GetMux returns the rpc mux.
func (*DebugDbResource) GetStorageInfo ¶
func (r *DebugDbResource) GetStorageInfo( _ context.Context, _ *s4wave_debugdb.GetStorageInfoRequest, ) (*s4wave_debugdb.GetStorageInfoResponse, error)
GetStorageInfo returns information about the current storage backend.
func (*DebugDbResource) StartBenchmark ¶
func (r *DebugDbResource) StartBenchmark( ctx context.Context, req *s4wave_debugdb.StartBenchmarkRequest, ) (*s4wave_debugdb.StartBenchmarkResponse, error)
StartBenchmark starts a new benchmark run.
type MetricCollector ¶
type MetricCollector struct {
// contains filtered or unexported fields
}
MetricCollector collects per-operation timing samples for a single metric.
func NewMetricCollector ¶
func NewMetricCollector(name, unit string) *MetricCollector
NewMetricCollector creates a new metric collector.
func (*MetricCollector) Build ¶
func (m *MetricCollector) Build() *s4wave_debugdb.BenchmarkMetric
Build computes aggregates and returns a BenchmarkMetric.
func (*MetricCollector) MaybeYield ¶
func (m *MetricCollector) MaybeYield()
MaybeYield calls runtime.Gosched if the sample count is a multiple of yieldInterval.
func (*MetricCollector) Record ¶
func (m *MetricCollector) Record(d time.Duration)
Record adds an explicit duration sample.
func (*MetricCollector) Stop ¶
func (m *MetricCollector) Stop()
Stop ends timing and records the sample.
type SuiteTimer ¶
type SuiteTimer struct {
// contains filtered or unexported fields
}
SuiteTimer helps run a suite for a target duration.
func NewSuiteTimer ¶
func NewSuiteTimer(totalDuration time.Duration, suiteCount, suiteIndex int) *SuiteTimer
NewSuiteTimer creates a timer for a suite's proportional share of the total duration.
func (*SuiteTimer) Running ¶
func (t *SuiteTimer) Running() bool
Running returns true if the suite still has time remaining.