Dip-All
0.91.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
home
coin
svn-release
Dip-0.91.5
Dip
src
UtilTimer.h
Go to the documentation of this file.
1
//===========================================================================//
2
// This file is part of the DIP Solver Framework. //
3
// //
4
// DIP is distributed under the Eclipse Public License as part of the //
5
// COIN-OR repository (http://www.coin-or.org). //
6
// //
7
// Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8
// //
9
// Conceptual Design: Matthew Galati, SAS Institute Inc. //
10
// Ted Ralphs, Lehigh University //
11
// //
12
// Copyright (C) 2002-2015, Lehigh University, Matthew Galati, and Ted Ralphs//
13
// All Rights Reserved. //
14
//===========================================================================//
15
16
#ifndef UTIL_TIMER_INCLUDED
17
#define UTIL_TIMER_INCLUDED
18
19
//===========================================================================//
20
#include "
CoinTime.hpp
"
21
22
//===========================================================================//
23
/* A timer used to record cpu and wallclock time. */
24
class
UtilTimer
{
25
private
:
27
double
startCpu_
;
28
double
finishCpu_
;
29
double
startReal_
;
30
double
finishReal_
;
31
33
double
cpu_
;
34
36
double
real_
;
37
38
public
:
39
UtilTimer
() {
40
reset
();
41
}
42
~UtilTimer
() {}
43
45
inline
void
reset
() {
46
start
();
47
finishCpu_
= 0.0;
48
finishReal_
= 0.0;
49
cpu_
= 0.0;
50
real_
= 0.0;
51
}
52
54
inline
void
start
() {
55
startCpu_
=
CoinCpuTime
();
56
startReal_
=
CoinGetTimeOfDay
();
57
}
58
60
inline
void
stop
() {
61
finishCpu_
=
CoinCpuTime
();
62
finishReal_
=
CoinGetTimeOfDay
();
63
cpu_
=
finishCpu_
-
startCpu_
;
64
real_
=
finishReal_
-
startReal_
;
65
}
66
68
inline
double
getCpuTime
() {
69
finishCpu_
=
CoinCpuTime
();
70
cpu_
=
finishCpu_
-
startCpu_
;
71
return
cpu_
;
72
}
73
75
inline
double
getRealTime
() {
76
finishReal_
=
CoinGetTimeOfDay
();
77
real_
=
finishReal_
-
startReal_
;
78
return
real_
;
79
}
80
83
inline
bool
isPast
(
double
limit) {
84
return
(
getRealTime
() > limit);
85
}
86
87
};
88
89
#endif
UtilTimer::start
void start()
Start to count times.
Definition:
UtilTimer.h:54
UtilTimer::cpu_
double cpu_
Cpu time.
Definition:
UtilTimer.h:33
UtilTimer::finishCpu_
double finishCpu_
Definition:
UtilTimer.h:28
UtilTimer::finishReal_
double finishReal_
Definition:
UtilTimer.h:30
UtilTimer
Definition:
UtilTimer.h:24
UtilTimer::getCpuTime
double getCpuTime()
Get cpu time.
Definition:
UtilTimer.h:68
UtilTimer::startCpu_
double startCpu_
Start, end markers.
Definition:
UtilTimer.h:27
UtilTimer::isPast
bool isPast(double limit)
Return whether the given amount of real time has elapsed since the timer was started.
Definition:
UtilTimer.h:83
UtilTimer::real_
double real_
Real clock time.
Definition:
UtilTimer.h:36
CoinCpuTime
static double CoinCpuTime()
Definition:
CoinTime.hpp:106
UtilTimer::getRealTime
double getRealTime()
Get wallClock time.
Definition:
UtilTimer.h:75
UtilTimer::reset
void reset()
Reset.
Definition:
UtilTimer.h:45
UtilTimer::stop
void stop()
Stop timer and computing times.
Definition:
UtilTimer.h:60
UtilTimer::startReal_
double startReal_
Definition:
UtilTimer.h:29
CoinGetTimeOfDay
double CoinGetTimeOfDay()
Definition:
CoinTime.hpp:69
UtilTimer::~UtilTimer
~UtilTimer()
Definition:
UtilTimer.h:42
CoinTime.hpp
UtilTimer::UtilTimer
UtilTimer()
Definition:
UtilTimer.h:39
Generated by
1.8.5