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

Revision 2198, 808 bytes checked in by mattausch, 18 years ago (diff)
RevLine 
[374]1#ifndef __STATISTICS_H
2#define __STATISTICS_H
3
4
5#include "common.h"
6
[860]7namespace GtpVisibilityPreprocessor {
8
[374]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  {
[2198]19    const double clk = 1.0E-3; // ticks per second
[2003]20    long t = time2 - time1;
[374]21               
[2003]22    return ((t < 0) ? -t : t) * clk;
[374]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 {
[469]38    return (float)TimeDiff(startTime, stopTime);
[374]39  }
40};
41
[860]42}
[374]43
44#endif
Note: See TracBrowser for help on using the repository browser.