File: timer.h

package info (click to toggle)
atlas-cpp 0.6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,192 kB
  • sloc: sh: 9,080; cpp: 6,447; xml: 3,660; python: 1,492; makefile: 166
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;