kaira.benchmarks.BenchmarkResultsManager

Inheritance diagram of BenchmarkResultsManager

Inheritance diagram for BenchmarkResultsManager

class kaira.benchmarks.BenchmarkResultsManager(base_dir: str | Path = 'results')[source]

Bases: object

Manages benchmark results with improved directory structure and organization.

Methods

__init__

Initialize the results manager.

archive_old_results

Archive benchmark results older than specified days.

cleanup_empty_directories

Remove empty directories in the results structure.

create_comparison_report

Create a comparison report from multiple benchmark results.

list_results

List available benchmark result files.

load_benchmark_result

Load a benchmark result from file.

save_benchmark_result

Save a single benchmark result with improved organization.

save_suite_results

Save multiple benchmark results from a suite.

__init__(base_dir: str | Path = 'results')[source]

Initialize the results manager.

Parameters:

base_dir – Base directory for storing all benchmark results

save_benchmark_result(result: BenchmarkResult, category: str = 'benchmarks', experiment_name: str | None = None, add_timestamp: bool = True) Path[source]

Save a single benchmark result with improved organization.

Parameters:
  • result – The benchmark result to save

  • category – Category (benchmarks, suites, experiments, etc.)

  • experiment_name – Optional experiment name for grouping

  • add_timestamp – Whether to add timestamp to filename

Returns:

Path to the saved file

save_suite_results(results: List[BenchmarkResult], suite_name: str, experiment_name: str | None = None) Dict[str, Path][source]

Save multiple benchmark results from a suite.

Parameters:
  • results – List of benchmark results

  • suite_name – Name of the benchmark suite

  • experiment_name – Optional experiment name

Returns:

Dictionary mapping result names to file paths

load_benchmark_result(filepath: str | Path) BenchmarkResult[source]

Load a benchmark result from file.

list_results(category: str | None = None, experiment_name: str | None = None) List[Path][source]

List available benchmark result files.

Parameters:
  • category – Specific category to list (benchmarks, suites, etc.)

  • experiment_name – Specific experiment to list

Returns:

List of result file paths (excludes summary files and comparison reports)

archive_old_results(days_old: int = 30) None[source]

Archive benchmark results older than specified days.

Parameters:

days_old – Number of days after which to archive results

cleanup_empty_directories() None[source]

Remove empty directories in the results structure.

create_comparison_report(result_paths: List[Path], report_name: str) Path[source]

Create a comparison report from multiple benchmark results.

Parameters:
  • result_paths – List of paths to benchmark result files

  • report_name – Name for the comparison report

Returns:

Path to the generated report