Skip to content

Latest commit

 

History

History
123 lines (67 loc) · 4.22 KB

File metadata and controls

123 lines (67 loc) · 4.22 KB

ankerl::nanobench Reference

.. doxygenclass:: ankerl::nanobench::Bench
    :members:



.. doxygenclass:: ankerl::nanobench::Rng
    :members:



.. doxygenclass:: ankerl::nanobench::Result
    :members:



.. doxygenfunction:: ankerl::nanobench::doNotOptimizeAway(Arg&& arg)



.. doxygenfunction:: ankerl::nanobench::render(char const *mustacheTemplate, Bench const &bench, std::ostream &out)


.. doxygenfunction:: ankerl::nanobench::templates::csv



.. doxygenfunction:: ankerl::nanobench::templates::htmlBoxplot



.. doxygenfunction:: ankerl::nanobench::templates::json


.. doxygenfunction:: ankerl::nanobench::templates::pyperf


Environment Variables

NANOBENCH_ENDLESS - Run a Specific Test Endlessly

Sometimes it helps to run a benchmark for a very long time, so that it's possible to attach with a profiler like perf and get meaningful statistics. This can be done with the environment variable NANOBENCH_ENDLESS. E.g. to run the benchmark with the name x += x endlessly, call the app this way:

NANOBENCH_ENDLESS="x += x" ./yourapp

When your app runs it will run all benchmark normally, but when it encounters a benchmarked named x += x, it will run this one endlessly. It will print in nice friendly letters

NANOBENCH_ENDLESS set: running 'x += x' endlessly

once it reaches that state.

Warning

For optimal profiling with perf, you shouldn't use pyperf system tune in the endless mode. PyPerf dramatically reduces the number of events that can be captured per second. This is a good to get accurate benchmark numbers from nanobench, but a bad when you actually want to use perf to analyze hotspots.

NANOBENCH_SUPPRESS_WARNINGS - No Stability Warnings

In environments where it is clear that the results will not be stable, e.g. in CI where benchmarks are merely run to check if they don't cause a crash, the environment variable NANOBENCH_SUPPRESS_WARNINGS can be used to suppress any warnings. This includes the header warnings like for frequency scaling, and the :wavy_dash: warnings for the individual tests.

Set NANOBENCH_SUPPRESS_WARNINGS=1 to disable all warnings, or set it to 0 to enable warnings (the default mode).

NANOBENCH_SUPPRESS_WARNINGS=1 ./yourapp