NDDEM
Benchmark.h
Go to the documentation of this file.
1 // #include <string>
2 // #include <vector>
3 // #include <map>
4 // #include <chrono>
5 // #include <stack>
6 //
7 //
8 //
9 // class Benchmark
10 // {
11 // public:
12 // // Disabled versions:
13 // static void start_clock ([[maybe_unused]] const std::string &name ) {}
14 // static void stop_clock ([[maybe_unused]] const std::string &name ) {}
15 // static void write_all() {} ;
16 //
17 //
18 // /* static void start_clock (const std::string &name) {current.push(name) ; current_start.push(std::chrono::high_resolution_clock::now()) ;}
19 // static void stop_clock (const std::string &name)
20 // {
21 // if (name!=current.top()) printf("Benchmark error: wrong stack %s\n", name.c_str()) ;
22 // auto delay=std::chrono::high_resolution_clock::now() - current_start.top() ;
23 // auto t=infos[name] ;
24 // std::get<0>(t) ++ ;
25 // std::get<1>(t) +=delay ;
26 // infos[name]=t ;
27 // current.pop() ; current_start.pop() ;
28 // }
29 // static void write_all()
30 // {
31 // printf("\n\nName | Total | Count | Time/count |\n") ;
32 // for (auto v:infos)
33 // {
34 // printf("%10s | %10g | %10d | %10g |\n", v.first.c_str(), std::get<1>(v.second).count(), std::get<0>(v.second), std::get<1>(v.second).count()/std::get<0>(v.second)) ;
35 // }
36 // }*/
37 //
38 // private:
39 // static std::map <std::string, std::tuple<int, std::chrono::duration<double>>> infos ;
40 // static std::stack<std::string> current ;
41 // static std::stack<std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >> current_start ;
42 // };
43 //
44 //
45 //
46 // std::map <std::string, std::tuple<int, std::chrono::duration<double>>> Benchmark::infos ;
47 // std::stack<std::string> Benchmark::current ;
48 // std::stack<std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >> Benchmark::current_start ;