simplebench.stats.memory_usage moduleπ
Containers for benchmark statistics
- class simplebench.stats.memory_usage.MemoryUsage(
- *,
- iterations: Sequence[Iteration] | None = None,
- unit: str = 'bytes',
- scale: float = 1.0,
- rounds: int = 1,
- data: Sequence[int | float] | None = None,
Bases:
StatsContainer for the memory usage statistics of a benchmark.
- Variables:
unit (str) β The unit of measurement for the memory usage (e.g., βMBβ).
scale (float) β The scale factor for the memory usage (e.g., β1e6β for megabytes).
rounds (int) β The number of data points in the benchmark.
data (tuple[float | int, ...]) β Tuple of memory usage data points.
mean (float) β The mean memory usage.
median (float) β The median memory usage.
minimum (float) β The minimum memory usage.
maximum (float) β The maximum memory usage.
standard_deviation (float) β The standard deviation of the memory usage.
relative_standard_deviation (float) β The relative standard deviation of the memory usage.
percentiles (dict[int, float]) β Percentiles of memory usage.
Construct MemoryUsage stats from sequence of Iteration or raw memory data.
At least one of
iterationsordatamust be provided.If provided,
iterationsmust be a sequence ofIterationobjects and memory data will be extracted from eachmemoryattribute. Ifdatais also provided, the memory data extracted from the iterations will be appended to the provided data.- Parameters:
iterations β Optional list of
Iterationobjects to extract memory data from.unit β Optional unit of measurement for the memory usage (e.g., βMBβ). Defaults to βbytesβ.
scale β Optional scale factor for the memory usage (e.g., β1e6β for megabytes). Defaults to 1.0.
rounds β The number of data points in the benchmark. Defaults to 1.
data β Optional list of memory usage data points. If not provided, memory data will be extracted from the iterations if available.
- Raises:
SimpleBenchTypeError β If any of the arguments are of the wrong type.
SimpleBenchValueError β If any of the arguments have invalid values.
- class simplebench.stats.memory_usage.MemoryUsageSummary(
- *,
- unit: str,
- scale: float,
- rounds: int,
- mean: float,
- median: float,
- minimum: float,
- maximum: float,
- standard_deviation: float,
- relative_standard_deviation: float,
- percentiles: tuple[float, ...],
Bases:
StatsSummaryContainer for summary statistics of a MemoryUsage benchmark.
This class is exclusive of raw data points.
- Variables:
unit (str) β The unit of measurement for the benchmark (e.g., βops/sβ).
scale (float) β The scale factor for the interval (e.g. 1 for seconds).
rounds (int) β The number of data points in the benchmark.
data (tuple[int | float, ...]) β Always an empty tuple as a
StatsSummaryobject does not contain raw data points.mean (float) β The mean operations per time interval.
median (float) β The median operations per time interval.
minimum (float) β The minimum operations per time interval.
maximum (float) β The maximum operations per time interval.
standard_deviation (float) β The standard deviation of operations per time interval.
relative_standard_deviation (float) β The relative standard deviation of ops per time interval.
percentiles (tuple[float, ...]) β Percentiles of operations per time interval.
Initialize the StatsSummary object.
- Parameters:
unit (str) β The unit of measurement for the data (e.g., βops/sβ).
scale (float) β The scale factor the data (e.g. 1.0 for seconds).
rounds (int) β The number of rounds each data point represents.
mean (float) β The mean data point.
median (float) β The median data point.
minimum (float) β The minimum data point.
maximum (float) β The maximum data point.
standard_deviation (float) β The standard deviation of data.
relative_standard_deviation (float) β The relative standard deviation of data.
- Raises:
SimpleBenchTypeError β If any of the arguments are of the wrong type.
SimpleBenchValueError β If any of the arguments have invalid values.