tests/benchmark_tools.h
author Alpar Juttner <alpar@cs.elte.hu>
Sun, 11 Dec 2011 07:33:29 +0100
changeset 10 d7ce0311ece2
child 11 cf6519daa7fa
permissions -rw-r--r--
Some common benchmarking tools added
alpar@10
     1
#ifndef BENCHMARK_TOOLS_H
alpar@10
     2
#define BENCHMARK_TOOLS_H
alpar@10
     3
alpar@10
     4
#include<string>
alpar@10
     5
#include<iostream>
alpar@10
     6
#include<iomanip>
alpar@10
     7
#include<lemon/time_measure.h>
alpar@10
     8
alpar@10
     9
extern const char test_name[];
alpar@10
    10
alpar@10
    11
inline void logTime(const std::string &subtest_name, const
alpar@10
    12
                    lemon::TimeStamp &time)
alpar@10
    13
{
alpar@10
    14
  std::cout << "*** " << test_name << ' ' << subtest_name << ' '
alpar@10
    15
	    << std::setiosflags(std::ios::fixed) << std::setprecision(4)
alpar@10
    16
	    << time.realTime() << ' '
alpar@10
    17
            << time.realTime()/(time.userTime()+time.systemTime()) - 1.0
alpar@10
    18
            << std::endl;
alpar@10
    19
}
alpar@10
    20
alpar@10
    21
#endif