Menu

[2d617b]: / tests / Clock.hh  Maximize  Restore  History

Download this file

45 lines (35 with data), 834 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* $Id$
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef __CLOCK_H
#define __CLOCK_H
#include <log4cpp/Portability.hh>
#ifdef LOG4CPP_HAVE_STDINT_H
#include <stdint.h>
#endif // LOG4CPP_HAVE_STDINT_H
#ifdef __osf__
typedef long usec_t; /* number of microseconds since 1970/01/01 */
# define INT64_CONSTANT(val) (val##L)
#else
typedef int64_t usec_t;
# define INT64_CONSTANT(val) (val##LL)
#endif
class Clock
{
public:
static bool UsingCPU;
static usec_t time(void);
Clock(void);
~Clock(void);
bool active(void) const { return _active; }
usec_t elapsed(void) const;
usec_t start(void);
usec_t reset(void) { return start(); }
usec_t stop(void);
private:
usec_t _start;
usec_t _elapsed;
bool _active;
};
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.