SoPlex
Toggle main menu visibility
Loading...
Searching...
No Matches
src
soplex
wallclocktimer.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-2026 Zuse Institute Berlin (ZIB) */
7
/* */
8
/* Licensed under the Apache License, Version 2.0 (the "License"); */
9
/* you may not use this file except in compliance with the License. */
10
/* You may obtain a copy of the License at */
11
/* */
12
/* http://www.apache.org/licenses/LICENSE-2.0 */
13
/* */
14
/* Unless required by applicable law or agreed to in writing, software */
15
/* distributed under the License is distributed on an "AS IS" BASIS, */
16
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17
/* See the License for the specific language governing permissions and */
18
/* limitations under the License. */
19
/* */
20
/* You should have received a copy of the Apache-2.0 license */
21
/* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22
/* */
23
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25
/**@file wallclocktimer.h
26
* @brief WallclockTimer class.
27
*/
28
29
#ifndef _WALLCLOCK_TIMER_H_
30
#define _WALLCLOCK_TIMER_H_
31
32
#include "
soplex/spxdefines.h
"
33
#include "
soplex/timer.h
"
34
35
namespace
soplex
36
{
37
38
class
WallclockTimer
:
public
Timer
39
{
40
private
:
41
42
//------------------------------------
43
/**@name Data */
44
///@{
45
mutable
time_t
sec
;
///< seconds
46
mutable
time_t
usec
;
///< microseconds
47
48
mutable
Real
lasttime
;
49
///@}
50
51
//------------------------------------
52
/**@name Internal helpers */
53
///@{
54
/// convert wallclock time to secounds.
55
Real
wall2sec
(time_t s, time_t us)
const
56
{
57
return
(
Real
)s + 0.000001 * (
Real
)us;
58
}
59
60
///@}
61
62
public
:
63
64
//------------------------------------
65
/**@name Construction / destruction */
66
///@{
67
/// default constructor
68
WallclockTimer
()
69
:
Timer
(),
sec
(0),
usec
(0),
lasttime
(0.0)
70
{}
71
/// copy constructor
72
WallclockTimer
(
const
WallclockTimer
& old)
73
:
Timer
(),
sec
(old.
sec
),
usec
(old.
usec
),
lasttime
(old.
lasttime
)
74
{}
75
/// assignment operator
76
WallclockTimer
&
operator=
(
const
WallclockTimer
& old)
77
{
78
sec
= old.
sec
;
79
usec
= old.
usec
;
80
lasttime
= old.
lasttime
;
81
return
*
this
;
82
}
83
84
virtual
~WallclockTimer
()
85
{}
86
///@}
87
88
//------------------------------------
89
/**@name Control */
90
///@{
91
/// initialize timer, set timing accounts to zero.
92
virtual
void
reset
()
93
{
94
status
=
RESET
;
95
sec
=
usec
= 0;
96
lasttime
= 0.0;
97
}
98
99
/// start timer, resume accounting user, system and real time.
100
virtual
void
start
();
101
102
/// stop timer, return accounted user time.
103
virtual
Real
stop
();
104
105
/// return type of timer
106
virtual
TYPE
type
()
107
{
108
return
WALLCLOCK_TIME
;
109
}
110
///@}
111
112
//------------------------------------
113
/**@name Access */
114
///@{
115
virtual
Real
time
()
const
;
116
117
virtual
Real
lastTime
()
const
;
118
119
///@}
120
};
121
}
// namespace soplex
122
#endif
// _WALLCLOCK_TIMER_H_
soplex::Timer::RESET
@ RESET
reset
Definition
timer.h:95
soplex::Timer::TYPE
TYPE
types of timers
Definition
timer.h:109
soplex::Timer::WALLCLOCK_TIME
@ WALLCLOCK_TIME
Definition
timer.h:112
soplex::Timer::status
enum soplex::Timer::@172027350133147052164065250373301051153114204073 status
status of the timer
soplex::Timer::Timer
Timer()
default constructor
Definition
timer.h:120
soplex::WallclockTimer::sec
time_t sec
seconds
Definition
wallclocktimer.h:45
soplex::WallclockTimer::stop
virtual Real stop()
stop timer, return accounted user time.
Definition
wallclocktimer.cpp:74
soplex::WallclockTimer::lastTime
virtual Real lastTime() const
Definition
wallclocktimer.cpp:135
soplex::WallclockTimer::WallclockTimer
WallclockTimer()
default constructor
Definition
wallclocktimer.h:68
soplex::WallclockTimer::WallclockTimer
WallclockTimer(const WallclockTimer &old)
copy constructor
Definition
wallclocktimer.h:72
soplex::WallclockTimer::start
virtual void start()
start timer, resume accounting user, system and real time.
Definition
wallclocktimer.cpp:42
soplex::WallclockTimer::operator=
WallclockTimer & operator=(const WallclockTimer &old)
assignment operator
Definition
wallclocktimer.h:76
soplex::WallclockTimer::lasttime
Real lasttime
Definition
wallclocktimer.h:48
soplex::WallclockTimer::time
virtual Real time() const
Definition
wallclocktimer.cpp:108
soplex::WallclockTimer::reset
virtual void reset()
initialize timer, set timing accounts to zero.
Definition
wallclocktimer.h:92
soplex::WallclockTimer::~WallclockTimer
virtual ~WallclockTimer()
Definition
wallclocktimer.h:84
soplex::WallclockTimer::wall2sec
Real wall2sec(time_t s, time_t us) const
convert wallclock time to secounds.
Definition
wallclocktimer.h:55
soplex::WallclockTimer::type
virtual TYPE type()
return type of timer
Definition
wallclocktimer.h:106
soplex::WallclockTimer::usec
time_t usec
microseconds
Definition
wallclocktimer.h:46
soplex
Everything should be within this namespace.
soplex::Real
double Real
Definition
spxdefines.h:269
spxdefines.h
Debugging, floating point type and parameter definitions.
timer.h
Timer class.
Generated by
1.17.0