BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
SYSTEM
timer.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
// $Id: timer.h,v 1.17 2005/07/29 12:38:15 amoll Exp $
5
//
6
7
#ifndef BALL_SYSTEM_TIMER_H
8
#define BALL_SYSTEM_TIMER_H
9
10
#ifndef BALL_COMMON_H
11
# include <
BALL/common.h
>
12
#endif
13
14
#ifdef BALL_HAS_SYS_TIME_H
15
# include <sys/time.h>
16
#endif
17
#ifdef BALL_HAS_TIME_H
18
# include <time.h>
19
#endif
20
21
22
23
#include <iostream>
24
25
namespace
BALL
26
{
30
class
BALL_EXPORT
Timer
31
{
32
public
:
33
37
41
Timer
();
42
46
Timer
(
Timer
& timer);
47
51
virtual
~
Timer
();
52
54
57
62
void
clear();
63
69
bool
start();
70
76
bool
stop();
77
82
void
reset();
83
85
89
93
double
getClockTime()
const
;
94
98
double
getUserTime()
const
;
99
103
double
getSystemTime()
const
;
104
109
double
getCPUTime()
const
;
110
112
116
122
Timer
& operator = (
const
Timer
& timer);
123
125
129
133
bool
isRunning()
const
;
134
142
bool
operator == (
const
Timer
& timer)
const
;
143
151
bool
operator != (
const
Timer
& timer)
const
;
152
159
bool
operator < (
const
Timer
& timer)
const
;
160
167
bool
operator <= (
const
Timer
& timer)
const
;
168
175
bool
operator >= (
const
Timer
& timer)
const
;
176
183
bool
operator > (
const
Timer
& timer)
const
;
184
186
189
193
bool
isValid()
const
;
194
197
void
dump(::std::ostream& s = ::std::cout,
Size
depth = 0L)
const
;
198
200
201
protected
:
202
203
private
:
204
205
static
LongSize
cpu_speed_
;
206
207
#ifdef BALL_HAS_WINDOWS_PERFORMANCE_COUNTER
208
static
PointerSizeUInt
clock_speed_;
209
#endif
210
211
// state of timer, either true(on) or false(off)
212
bool
is_running_
;
213
214
// clock seconds value when the timer was last started
215
LongSize
last_secs_
;
216
217
// clock useconds value when the timer was last started
218
LongSize
last_usecs_
;
219
220
// user time when the timer was last started
221
clock_t
last_user_time_
;
222
223
// system time when the timer was last started
224
clock_t
last_system_time_
;
225
226
// current accumulated clock seconds
227
LongSize
current_secs_
;
228
229
// current accumulated clock useconds
230
LongSize
current_usecs_
;
231
232
// current accumulated user time
233
clock_t
current_user_time_
;
234
235
// current accumulated user time
236
clock_t
current_system_time_
;
237
};
238
239
# ifndef BALL_NO_INLINE_FUNCTIONS
240
# include "timer.iC"
241
# endif
242
243
}
244
245
#endif // BALL_SYSTEM_TIMER_H
Generated by
1.8.3.1