00001 /* $Id: Clock.hh,v 1.5 2002/09/15 22:40:50 bastiaan Exp $ 00002 * 00003 * See the COPYING file for the terms of usage and distribution. 00004 */ 00005 00006 #ifndef __CLOCK_H 00007 #define __CLOCK_H 00008 00009 #ifdef LOG4CPP_HAVE_STDINT_H 00010 #include <stdint.h> 00011 #endif // LOG4CPP_HAVE_STDINT_H 00012 00013 #ifdef __osf__ 00014 typedef long usec_t; /* number of microseconds since 1970/01/01 */ 00015 # define INT64_CONSTANT(val) (val##L) 00016 #else 00017 typedef int64_t usec_t; 00018 # define INT64_CONSTANT(val) (val##LL) 00019 #endif 00020 00021 class Clock 00022 { 00023 public: 00024 static bool UsingCPU; 00025 static usec_t time(void); 00026 00027 Clock(void); 00028 ~Clock(void); 00029 00030 bool active(void) const { return _active; } 00031 usec_t elapsed(void) const; 00032 usec_t start(void); 00033 usec_t reset(void) { return start(); } 00034 usec_t stop(void); 00035 00036 private: 00037 usec_t _start; 00038 usec_t _elapsed; 00039 bool _active; 00040 }; 00041 00042 #endif