![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
Namespaces | |
| namespace | templates |
| namespace | detail |
Classes | |
| struct | Config |
| class | Result |
| class | Rng |
| An extremely fast random generator. More... | |
| class | Bench |
| Main entry point to nanobench's benchmarking facility. More... | |
| class | BigO |
Typedefs | |
| using | Clock |
Functions | |
| void | render (char const *mustacheTemplate, Bench const &bench, std::ostream &out) |
| Renders output from a mustache-like template and benchmark results. | |
| void | render (std::string const &mustacheTemplate, Bench const &bench, std::ostream &out) |
| void | render (char const *mustacheTemplate, std::vector< Result > const &results, std::ostream &out) |
| Same as render(char const* mustacheTemplate, Bench const& bench, std::ostream& out), but for when you only have results available. | |
| void | render (std::string const &mustacheTemplate, std::vector< Result > const &results, std::ostream &out) |
| template<typename Arg> | |
| void | doNotOptimizeAway (Arg &&arg) |
| Makes sure none of the given arguments are optimized away by the compiler. | |
| std::ostream & | operator<< (std::ostream &os, BigO const &bigO) |
| std::ostream & | operator<< (std::ostream &os, std::vector< ankerl::nanobench::BigO > const &bigOs) |
| using ankerl::nanobench::Clock |
Definition at line 132 of file nanobench.h.
| void ankerl::nanobench::doNotOptimizeAway | ( | Arg && | arg | ) |
Makes sure none of the given arguments are optimized away by the compiler.
| Arg | Type of the argument that shouldn't be optimized away. |
| arg | The input that we mark as being used, even though we don't do anything with it. |
Definition at line 1279 of file nanobench.h.
| std::ostream & ankerl::nanobench::operator<< | ( | std::ostream & | os, |
| BigO const & | bigO ) |
| std::ostream & ankerl::nanobench::operator<< | ( | std::ostream & | os, |
| std::vector< ankerl::nanobench::BigO > const & | bigOs ) |
| void ankerl::nanobench::render | ( | char const * | mustacheTemplate, |
| Bench const & | bench, | ||
| std::ostream & | out ) |
Renders output from a mustache-like template and benchmark results.
The templating facility here is heavily inspired by mustache - logic-less templates. It adds a few more features that are necessary to get all of the captured data out of nanobench. Please read the excellent mustache manual to see what this is all about.
nanobench output has two nested layers, result and measurement. Here is a hierarchy of the allowed tags:
{{#result}} Marks the begin of the result layer. Whatever comes after this will be instantiated as often as a benchmark result is available. Within it, you can use these tags:
Apart from these tags, it is also possible to use some mathematical operations on the measurement data. The operations are of the form {{command(name)}}. Currently name can be one of elapsed, iterations. If performance counters are available (currently only on current Linux systems), you also have pagefaults, cpucycles, contextswitches, instructions, branchinstructions, and branchmisses. All the measures (except iterations) are provided for a single iteration (so elapsed is the time a single iteration took). The following tags are available:
{{medianAbsolutePercentError(<name>)}} Calculates MdAPE, the Median Absolute Percentage Error. The MdAPE is an excellent metric for the variation of measurements. It is more robust to outliers than the Mean absolute percentage error (M-APE).
![\[ \mathrm{MdAPE}(e) = \mathrm{med}\{| \frac{e_i - \mathrm{med}\{e\}}{e_i}| \}
\]](form_0.png)
E.g. for elapsed: First, 

This measurement is a bit hard to interpret, but it is very robust against outliers. E.g. a value of 5% means that half of the measurements deviate less than 5% from the median, and the other deviate more than 5% from the median.
![\[ \mathrm{sumProduct}(a,b) = \sum_{i=1}^{n}a_i\cdot b_i
\]](form_3.png)
{{/result}} Marks the end of the result layer. This is the end marker for the template part that will be instantiated for each benchmark result.
For the layer tags result and measurement you additionally can use these special markers:
embed:rst For an overview of all the possible data you can get out of nanobench, please see the tutorial at :ref:`tutorial-template-json`. The templates that ship with nanobench are: * :cpp:func:`templates::csv() <ankerl::nanobench::templates::csv()>` * :cpp:func:`templates::json() <ankerl::nanobench::templates::json()>` * :cpp:func:`templates::htmlBoxplot() <ankerl::nanobench::templates::htmlBoxplot()>` * :cpp:func:`templates::pyperf() <ankerl::nanobench::templates::pyperf()>`
| mustacheTemplate | The template. |
| bench | Benchmark, containing all the results. |
| out | Output for the generated output. |
| void ankerl::nanobench::render | ( | char const * | mustacheTemplate, |
| std::vector< Result > const & | results, | ||
| std::ostream & | out ) |
Same as render(char const* mustacheTemplate, Bench const& bench, std::ostream& out), but for when you only have results available.
| mustacheTemplate | The template. |
| results | All the results to be used for rendering. |
| out | Output for the generated output. |
| void ankerl::nanobench::render | ( | std::string const & | mustacheTemplate, |
| Bench const & | bench, | ||
| std::ostream & | out ) |
| void ankerl::nanobench::render | ( | std::string const & | mustacheTemplate, |
| std::vector< Result > const & | results, | ||
| std::ostream & | out ) |