File: timer.h

package info (click to toggle)
atlas-cpp 0.6.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 4,684 kB
  • sloc: cpp: 6,791; sh: 4,246; xml: 3,660; python: 1,826; makefile: 194; perl: 164
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;