source: GTP/trunk/Lib/Vis/Preprocessing/src/Statistics.h @ 860

Revision 860, 794 bytes checked in by mattausch, 19 years ago (diff)
Line 
1#ifndef __STATISTICS_H
2#define __STATISTICS_H
3
4
5#include "common.h"
6
7namespace GtpVisibilityPreprocessor {
8
9// --------------------------------------------------------------
10// Statistics for search - base class
11// --------------------------------------------------------------
12class StatisticsBase
13{
14public:
15       
16  // return time diff. in s
17  static inline double TimeDiff(long time1, long time2) // in s
18  {
19    const double clk=1.0E-6; // ticks per second
20    long t=time2-time1;
21               
22    return ((t<0)?-t:t)*clk;
23  }
24       
25public:
26  long startTime;
27  long stopTime;
28 
29  void Start() {
30    startTime = GetTime();
31  }
32
33  void Stop() {
34    stopTime = GetTime();
35  }
36
37  float Time() const {
38    return (float)TimeDiff(startTime, stopTime);
39  }
40};
41
42}
43
44#endif
Note: See TracBrowser for help on using the repository browser.