tests/benchmark_tools.h
changeset 11 cf6519daa7fa
parent 10 d7ce0311ece2
child 12 4eab99ff2666
equal deleted inserted replaced
0:4cc15714489f 1:a8216579062a
     4 #include<string>
     4 #include<string>
     5 #include<iostream>
     5 #include<iostream>
     6 #include<iomanip>
     6 #include<iomanip>
     7 #include<lemon/time_measure.h>
     7 #include<lemon/time_measure.h>
     8 
     8 
     9 extern const char test_name[];
     9 extern std::string test_name;
       
    10 extern std::string instance_name;
    10 
    11 
    11 inline void logTime(const std::string &subtest_name, const
    12 extern const std::string DATADIR_PATH;
    12                     lemon::TimeStamp &time)
    13 
       
    14 
       
    15 inline void logTime(const std::string &_instance_name,
       
    16 		    const std::string &subtest_name,
       
    17 		    const lemon::TimeStamp &time)
    13 {
    18 {
    14   std::cout << "*** " << test_name << ' ' << subtest_name << ' '
    19   std::cout << "*** " << test_name
    15 	    << std::setiosflags(std::ios::fixed) << std::setprecision(4)
    20 	    << ' ' << _instance_name
       
    21 	    << ' ' << subtest_name
       
    22 	    << ' ' << std::setiosflags(std::ios::fixed) << std::setprecision(4)
    16 	    << time.realTime() << ' '
    23 	    << time.realTime() << ' '
    17             << time.realTime()/(time.userTime()+time.systemTime()) - 1.0
    24             << time.realTime()/(time.userTime()+time.systemTime()) - 1.0
    18             << std::endl;
    25             << std::endl;
    19 }
    26 }
    20 
    27 
       
    28 inline void logTime(const std::string &subtest_name,
       
    29 		    const lemon::TimeStamp &time)
       
    30 {
       
    31   logTime(instance_name,subtest_name,time);
       
    32 }
       
    33 
    21 #endif
    34 #endif