/usr/share/doc/libwreport-doc/apidocs/benchmark_8h_source.html is in libwreport-doc 3.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>libwreport: benchmark.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libwreport
 <span id="projectnumber">3.6</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_a77a435eba5a6a11d9ac0a833d87986c.html">wreport</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">benchmark.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="benchmark_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef WREPORT_BENCHMARK_H</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define WREPORT_BENCHMARK_H</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <vector></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <functional></span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <cstdio></span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="namespacewreport.html"> 13</a></span> <span class="keyword">namespace </span><a class="code" href="namespacewreport.html">wreport</a> {</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">namespace </span>benchmark {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="keyword">struct </span>Benchmark;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Task.html"> 19</a></span> <span class="keyword">struct </span><a class="code" href="structwreport_1_1benchmark_1_1Task.html">Task</a></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="comment">// Unmanaged pointer to the benchmark we belong to</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>* parent;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="comment">// Name of this task</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  std::string name;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="comment">// Number of time this task has run</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordtype">unsigned</span> run_count = 0;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="comment">// Total user time</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  clock_t utime = 0;</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="comment">// Total system time</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  clock_t stime = 0;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <a class="code" href="structwreport_1_1benchmark_1_1Task.html">Task</a>(<a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>* parent, <span class="keyword">const</span> std::string& name);</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="comment">// Run the given function and collect timings for it</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordtype">void</span> collect(std::function<<span class="keywordtype">void</span>()> f);</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> };</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Progress.html"> 40</a></span> <span class="keyword">struct </span><a class="code" href="structwreport_1_1benchmark_1_1Progress.html">Progress</a></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keyword">virtual</span> ~<a class="code" href="structwreport_1_1benchmark_1_1Progress.html">Progress</a>() {}</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> start_benchmark(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b) = 0;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> end_benchmark(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b) = 0;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> start_iteration(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, <span class="keywordtype">unsigned</span> cur, <span class="keywordtype">unsigned</span> total) = 0;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> end_iteration(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, <span class="keywordtype">unsigned</span> cur, <span class="keywordtype">unsigned</span> total) = 0;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> test_failed(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, std::exception& e) = 0;</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> };</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1BasicProgress.html"> 56</a></span> <span class="keyword">struct </span><a class="code" href="structwreport_1_1benchmark_1_1BasicProgress.html">BasicProgress</a> : <a class="code" href="structwreport_1_1benchmark_1_1Progress.html">Progress</a></div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  FILE* out;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  FILE* err;</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="structwreport_1_1benchmark_1_1BasicProgress.html">BasicProgress</a>(FILE* out=stdout, FILE* err=stderr);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordtype">void</span> start_benchmark(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b) <span class="keyword">override</span>;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordtype">void</span> start_iteration(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, <span class="keywordtype">unsigned</span> cur, <span class="keywordtype">unsigned</span> total) <span class="keyword">override</span>;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordtype">void</span> end_iteration(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, <span class="keywordtype">unsigned</span> cur, <span class="keywordtype">unsigned</span> total) <span class="keyword">override</span>;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">void</span> end_benchmark(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b) <span class="keyword">override</span>;</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordtype">void</span> test_failed(<span class="keyword">const</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>& b, std::exception& e) <span class="keyword">override</span>;</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> };</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Benchmark.html"> 74</a></span> <span class="keyword">struct </span><a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span> {</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="comment">// Name of this benchmark</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  std::string name;</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">// Number of repetitions</span></div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordtype">unsigned</span> repetitions = 10;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment">// Unmanaged pointers to the tasks in this benchmark</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  std::vector<Task*> tasks;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="comment">// Main task, collecting timings for the toplevel run</span></div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="structwreport_1_1benchmark_1_1Task.html">Task</a> task_main;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>(<span class="keyword">const</span> std::string& name);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keyword">virtual</span> ~<a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>();</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Benchmark.html#aa7c112b893d00eee628d21b8d159f359"> 93</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html#aa7c112b893d00eee628d21b8d159f359">setup_main</a>() {}</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Benchmark.html#a0f6fcc2177b2a02fd337a330c4839b06"> 100</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html#a0f6fcc2177b2a02fd337a330c4839b06">teardown_main</a>() {}</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div><div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Benchmark.html#afe930a1d9a64d10b080f467f27f0c4d3"> 107</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html#afe930a1d9a64d10b080f467f27f0c4d3">setup_iteration</a>() {}</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> </div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Benchmark.html#a6863ab2529fc679808394654bdaaea35"> 114</a></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html#a6863ab2529fc679808394654bdaaea35">teardown_iteration</a>() {}</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordtype">void</span> run(<a class="code" href="structwreport_1_1benchmark_1_1Progress.html">Progress</a>& progress);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordtype">void</span> print_timings();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> main() = 0;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> };</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div><div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="structwreport_1_1benchmark_1_1Registry.html"> 127</a></span> <span class="keyword">struct </span><a class="code" href="structwreport_1_1benchmark_1_1Registry.html">Registry</a></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span> {</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  std::vector<Benchmark*> benchmarks;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">void</span> add(<a class="code" href="structwreport_1_1benchmark_1_1Benchmark.html">Benchmark</a>* b);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keyword">static</span> <a class="code" href="structwreport_1_1benchmark_1_1Registry.html">Registry</a>& <span class="keyword">get</span>();</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> basic_run(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>* argv[]);</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> };</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> }</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> }</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> </div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="preprocessor">#endif</span></div><div class="ttc" id="structwreport_1_1benchmark_1_1BasicProgress_html"><div class="ttname"><a href="structwreport_1_1benchmark_1_1BasicProgress.html">wreport::benchmark::BasicProgress</a></div><div class="ttdoc">Basic progress implementation writing progress information to the given output stream. </div><div class="ttdef"><b>Definition:</b> benchmark.h:56</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Registry_html"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Registry.html">wreport::benchmark::Registry</a></div><div class="ttdoc">Collect all existing benchmarks. </div><div class="ttdef"><b>Definition:</b> benchmark.h:127</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Benchmark_html"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Benchmark.html">wreport::benchmark::Benchmark</a></div><div class="ttdoc">Base class for all benchmarks. </div><div class="ttdef"><b>Definition:</b> benchmark.h:74</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Benchmark_html_a6863ab2529fc679808394654bdaaea35"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Benchmark.html#a6863ab2529fc679808394654bdaaea35">wreport::benchmark::Benchmark::teardown_iteration</a></div><div class="ttdeci">virtual void teardown_iteration()</div><div class="ttdoc">Tear down the environment for an iteration of this benchmark. </div><div class="ttdef"><b>Definition:</b> benchmark.h:114</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Benchmark_html_a0f6fcc2177b2a02fd337a330c4839b06"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Benchmark.html#a0f6fcc2177b2a02fd337a330c4839b06">wreport::benchmark::Benchmark::teardown_main</a></div><div class="ttdeci">virtual void teardown_main()</div><div class="ttdoc">Tear down the environment for this benchmark. </div><div class="ttdef"><b>Definition:</b> benchmark.h:100</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Benchmark_html_afe930a1d9a64d10b080f467f27f0c4d3"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Benchmark.html#afe930a1d9a64d10b080f467f27f0c4d3">wreport::benchmark::Benchmark::setup_iteration</a></div><div class="ttdeci">virtual void setup_iteration()</div><div class="ttdoc">Set up the environment for an iteration of this benchmark. </div><div class="ttdef"><b>Definition:</b> benchmark.h:107</div></div>
<div class="ttc" id="namespacewreport_html"><div class="ttname"><a href="namespacewreport.html">wreport</a></div><div class="ttdoc">String functions. </div><div class="ttdef"><b>Definition:</b> benchmark.h:13</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Progress_html"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Progress.html">wreport::benchmark::Progress</a></div><div class="ttdoc">Notify of progress during benchmark execution. </div><div class="ttdef"><b>Definition:</b> benchmark.h:40</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Task_html"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Task.html">wreport::benchmark::Task</a></div><div class="ttdoc">Collect timings for one task. </div><div class="ttdef"><b>Definition:</b> benchmark.h:19</div></div>
<div class="ttc" id="structwreport_1_1benchmark_1_1Benchmark_html_aa7c112b893d00eee628d21b8d159f359"><div class="ttname"><a href="structwreport_1_1benchmark_1_1Benchmark.html#aa7c112b893d00eee628d21b8d159f359">wreport::benchmark::Benchmark::setup_main</a></div><div class="ttdeci">virtual void setup_main()</div><div class="ttdoc">Set up the environment for this benchmark. </div><div class="ttdef"><b>Definition:</b> benchmark.h:93</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Aug 18 2016 13:32:18 for libwreport by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
|