File: timer.h

package info (click to toggle)
atlas-cpp 0.6.1-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,740 kB
  • ctags: 2,298
  • sloc: sh: 9,024; cpp: 6,421; python: 1,485; makefile: 158
file content (11 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
#include <time.h>

clock_t calc_time0,calc_time1;
double calc_time;
#define TIME_ON  calc_time0=clock();
#define TIME_OFF(msg) calc_time1=clock();                    \
  calc_time=(double)(calc_time1-calc_time0)/CLOCKS_PER_SEC;  \
  std::cout<<msg<<": iterations="<<i                               \
      <<" CPU Time="<<calc_time                              \
      <<" iter/s="<<i/calc_time<<std::endl;