Merge branch 'charm' of charmgit:charm into bhatele/ldbcputimer
[charm.git] / src / ck-ldb / LBMachineUtil.h
1 /*****************************************************************************
2  * $Source$
3  * $Author$
4  * $Date$
5  * $Revision$
6  *****************************************************************************/
7
8 /**
9  * \addtogroup CkLdb
10 */
11 /*@{*/
12
13 #ifndef _LDMACHINEUTIL_H_
14 #define _LDMACHINEUTIL_H_
15
16 class LBMachineUtil {
17 public:
18   LBMachineUtil();
19   void StatsOn();
20   void StatsOff();
21   void Clear();
22   void TotalTime(double* walltime, double* cputime);
23   void IdleTime(double* walltime) { *walltime = total_idletime; };
24
25 private:
26   enum { off, on } state;
27   double total_walltime;
28   double total_idletime;
29   double start_totalwall;
30   double start_idle;
31 #if CMK_LB_CPUTIMER
32   double total_cputime;
33   double start_totalcpu;
34 #endif
35
36   int cancel_idleStart, cancel_idleEnd;
37
38   void IdleStart(double curWallTime);
39   void IdleEnd(double curWallTime);
40   static void staticIdleStart(LBMachineUtil *util,double curWallTime);
41   static void staticIdleEnd(LBMachineUtil *util,double curWallTime);
42 };
43
44 #endif  // _LDMACHINEUTIL_H_
45
46 /*@}*/