runtime

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package runtime contains common utilities use to meter time for benchmarks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepetitionDurationStats

func RepetitionDurationStats(reps int, setup, f, teardown func() error) (time.Duration, time.Duration, error)

RepetitionDurationStats extracts some duration stats by repeatedly execution and measuring runtime. Returns the mean and deviation of the run duration of the provided function. If an error is return by the function it will shortcut the execution and return just the error.

func TrackDuration

func TrackDuration(f func() error) (time.Duration, error)

TrackDuration measure the duration of the run time function using the wall clock. You should not consider the returned duration in the presence or an error since it will likely have shortcut the execution of the function being executed.

Types

type BenchEntry

type BenchEntry struct {
	BatteryID string
	ID        string
	Triples   int
	Reps      int
	Setup     func() error
	F         func() error
	TearDown  func() error
}

BenchEntry contains the bench entry id, the function to run, and the number of repetitions to run.

type BenchResult

type BenchResult struct {
	BatteryID string
	ID        string
	Triples   int
	Err       error
	Mean      time.Duration
	StdDev    time.Duration
}

BenchResult contains the results of running a bench mark.

func RunBenchmarkBatteryConcurrently

func RunBenchmarkBatteryConcurrently(entries []*BenchEntry) []*BenchResult

RunBenchmarkBatteryConcurrently runs all the bench entries and returns the timing results concurrently. The benchmarks will all be run concurrently.

func RunBenchmarkBatterySequentially

func RunBenchmarkBatterySequentially(entries []*BenchEntry) []*BenchResult

RunBenchmarkBatterySequentially runs all the bench entries and returns the timing results.

Jump to

Keyboard shortcuts

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