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