bencher.bench_report

Module Contents

Classes

BenchReport

A server for display plots of benchmark results

class bencher.bench_report.BenchReport(bench_name: str = None)

Bases: bencher.bench_plot_server.BenchPlotServer

A server for display plots of benchmark results

append_title(title: str, new_tab: bool = True)
append_markdown(markdown: str, name=None, width=800, **kwargs) panel.pane.Markdown
append(pane: panel.panel, name: str = None) None
append_col(pane: panel.panel, name: str = None) None
append_result(bench_res: bencher.results.bench_result.BenchResult) None
append_tab(pane: panel.panel, name: str = None) None
save_index(directory='', filename='index.html') pathlib.Path

Saves the result to index.html in the root folder so that it can be displayed by github pages.

Returns:

save path

Return type:

Path

save(directory: str | pathlib.Path = 'cachedir', filename: str = None, in_html_folder: bool = True, **kwargs) pathlib.Path

Save the result to a html file. Note that dynamic content will not work. by passing save(__file__) the html output will be saved in the same folder as the source code in a html subfolder.

Parameters:
  • directory (str | Path, optional) – base folder to save to. Defaults to “cachedir” which should be ignored by git.

  • filename (str, optional) – The name of the html file. Defaults to the name of the benchmark

  • in_html_folder (bool, optional) – Put the saved files in a html subfolder to help keep the results separate from source code. Defaults to True.

Returns:

the save path

Return type:

Path

show(run_cfg: bencher.bench_cfg.BenchRunCfg = None) threading.Thread

Launches a webserver with plots of the benchmark results, blocking

Parameters:

run_cfg (BenchRunCfg, optional) – Options for the webserve such as the port. Defaults to None.

publish(remote_callback: Callable, branch_name: str = None, debug: bool = False) str

Publish the results as an html file by committing it to the bench_results branch in the current repo. If you have set up your repo with github pages or equivalent then the html file will be served as a viewable webpage. This is an example of a callable to publish on github pages:

def publish_args(branch_name) -> Tuple[str, str]:
    return (
        "https://github.com/dyson-ai/bencher.git",
        f"https://github.com/dyson-ai/bencher/blob/{branch_name}")
Parameters:

remote (Callable) – A function the returns a tuple of the publishing urls. It must follow the signature def publish_args(branch_name) -> Tuple[str, str]. The first url is the git repo name, the second url needs to match the format for viewable html pages on your git provider. The second url can use the argument branch_name to point to the report on a specified branch.

Returns:

the url of the published report

Return type:

str