#include "PmbCxxUtils/CustomBenchmark.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cmath>
Go to the source code of this file.
◆ main()
| int main |
( |
int | , |
|
|
char ** | ) |
Definition at line 15 of file custombenchmark_example.cxx.
16{
17 srand(0);
18 const unsigned maxpdgrecord=99;
20
22 for (
unsigned i=0;
i<100;++
i) {
23 int pdg = -150+(
rand()%30)*10;
24 int id = std::min<unsigned>(maxpdgrecord,abs(pdg));
25 bench.begin(id);
26
27 for (unsigned j=0;j<3000*(abs(pdg)+1);++j)
29
30 bench.end();
31 }
32
33
34 for (
unsigned i=0;
i<100;++
i) {
35 int pdg = -150+(
rand()%30)*10;
36 int id = std::min<unsigned>(maxpdgrecord,abs(pdg));
37 {
39
40 for (unsigned j=0;j<3000*(abs(pdg)+1);++j)
42
43 }
44 }
45
46
47
48 for (unsigned pdg = 0; pdg<=maxpdgrecord; ++pdg) {
50 bench.getData(pdg,
count, time_ms);
52 std::cout<< "Work done on particle with |pdg|="<<pdg<<(pdg==maxpdgrecord?"+":"")
53 <<
" was done "<<
count<<
" times and took a total of "<<time_ms
54 <<
" milliseconds [on average "<<time_ms/
count<<
" ms each time]"<<std::endl;
55 }
56}
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string