asv_runner.benchmarks.track#

Module Contents#

Classes#

TrackBenchmark

Represents a single benchmark for tracking an arbitrary value.

Data#

API#

class asv_runner.benchmarks.track.TrackBenchmark(name, func, attr_sources)#

Bases: asv_runner.benchmarks._base.Benchmark

Represents a single benchmark for tracking an arbitrary value.

The TrackBenchmark class provides a benchmark type for tracking any arbitrary value that your code produces. This can be useful when you need to track a value that isn’t related to time or memory usage.

Attributes

name_regex (re.Pattern)

The regular expression used to match the names of functions that should be considered as track benchmarks.

type (str)

The type of the benchmark. The default type is “track”.

unit (str)

The unit of the value that’s being tracked. By default, this is “unit”.

Methods

*run(param)

Runs the benchmark function and returns its result.

Initialization

Initializes a new instance of the TrackBenchmark class.

Parameters

name (str)

The name of the benchmark.

func (callable)

The function to benchmark.

attr_sources (list)

A list of objects to search for attributes that might be used by the benchmark.

name_regex#

None

run(*param)#

Runs the benchmark function and returns its result.

Parameters

param (tuple)

The parameters to pass to the benchmark function.

Returns

result

The result of the benchmark function.

asv_runner.benchmarks.track.export_as_benchmark#

None