Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SoPlex 6.0.3
SoPlex 5.0.2
SoPlex 4.0.2
SoPlex 3.1.0
SoPlex 3.0.1
SoPlex 2.2.1
SoPlex
Sequential object-oriented simPlex
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
soplex-repo
src
usertimer.h
Go to the documentation of this file.
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2
/* */
3
/* This file is part of the class library */
4
/* SoPlex --- the Sequential object-oriented simPlex. */
5
/* */
6
/* Copyright (C) 1996-2015 Konrad-Zuse-Zentrum */
7
/* fuer Informationstechnik Berlin */
8
/* */
9
/* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10
/* */
11
/* You should have received a copy of the ZIB Academic License */
12
/* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13
/* */
14
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15
16
/**@file usertimer.h
17
* @brief UserTimer class.
18
*/
19
20
#ifndef _USER_TIMER_H_
21
#define _USER_TIMER_H_
22
23
#include "
spxdefines.h
"
24
#include "
timer.h
"
25
26
namespace
soplex
27
{
28
29
class
UserTimer
:
public
Timer
30
{
31
private
:
32
33
//------------------------------------
34
/**@name number of ticks per second */
35
//@{
36
static
const
long
ticks_per_sec
;
///< ticks per secound, should be constant
37
//@}
38
39
//------------------------------------
40
/**@name Data */
41
//@{
42
mutable
long
uAccount
;
///< user time
43
mutable
long
uTicks
;
///< user ticks
44
45
mutable
Real
lasttime
;
46
//@}
47
48
//------------------------------------
49
/**@name Internal helpers */
50
//@{
51
/// convert ticks to secounds.
52
Real
ticks2sec
(
long
ticks)
const
53
{
54
return
(
Real
(ticks) * 1000.0 /
Real
(
ticks_per_sec
)) / 1000.0;
55
}
56
57
/// get actual user ticks from the system.
58
void
updateTicks
()
const
;
59
60
//@}
61
62
public
:
63
64
//------------------------------------
65
/**@name Construction / destruction */
66
//@{
67
/// default constructor
68
UserTimer
()
69
:
Timer
(),
uAccount
(0),
uTicks
(0),
lasttime
(0.0)
70
{
71
assert(
ticks_per_sec
> 0);
72
}
73
/// copy constructor
74
UserTimer
(
const
UserTimer
& old)
75
:
Timer
(),
uAccount
(old.
uAccount
),
uTicks
(old.
uTicks
),
lasttime
(old.
lasttime
)
76
{
77
assert(
ticks_per_sec
> 0);
78
}
79
/// assignment operator
80
UserTimer
&
operator=
(
const
UserTimer
& old)
81
{
82
assert(
ticks_per_sec
> 0);
83
uAccount
= old.
uAccount
;
84
uTicks
= old.
uTicks
;
85
lasttime
= old.
lasttime
;
86
return
*
this
;
87
}
88
89
virtual
~UserTimer
()
90
{}
91
//@}
92
93
//------------------------------------
94
/**@name Control */
95
//@{
96
/// initialize timer, set timing accounts to zero.
97
virtual
void
reset
()
98
{
99
status
=
RESET
;
100
uAccount
= 0;
101
lasttime
= 0.0;
102
}
103
104
/// start timer, resume accounting user, system and real time.
105
virtual
void
start
();
106
107
/// stop timer, return accounted user time.
108
virtual
Real
stop
();
109
110
/// return type of timer
111
virtual
TYPE
type
()
112
{
113
return
USER_TIME
;
114
}
115
//@}
116
117
//------------------------------------
118
/**@name Access */
119
//@{
120
virtual
Real
time
()
const
;
121
122
virtual
Real
lastTime
()
const
;
123
//@}
124
};
125
}
// namespace soplex
126
#endif // _USER_TIMER_H_