OOFEM 3.0
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35#ifndef timer_h
36#define timer_h
37
38#include "oofemenv.h"
39
40#include <chrono>
41
42namespace oofem {
47{
49 std :: chrono :: time_point< std :: chrono :: high_resolution_clock >start_wtime, end_wtime;
51 std :: chrono :: duration< double >start_utime, end_utime;
53 std :: chrono :: duration< double >elapsedWTime, elapsedUTime;
55 bool running;
56
57public:
58 Timer();
59
60 void startTimer();
61 void stopTimer();
62 void pauseTimer();
63 void resumeTimer();
64 void initTimer();
65 bool isRunning() { return running; }
66
68 double getUtime();
70 double getWtime();
71
79 static void convert2HMS(int &nhrs, int &nmin, int &nsec, double tsec);
80
82 void toString(char *buff);
83
84 void updateElapsedTime();
85
86private:
88 void getUtime(std :: chrono :: duration< double > &answer);
90 void getTime(std :: chrono :: time_point< std :: chrono :: high_resolution_clock > &answer);
91};
92
99{
100public:
117
118protected:
121
122public:
125
128 void startTimer(EngngModelTimerType t) { timers [ t ].startTimer(); }
129 void stopTimer(EngngModelTimerType t) { timers [ t ].stopTimer(); }
130 void pauseTimer(EngngModelTimerType t) { timers [ t ].pauseTimer(); }
131 void resumeTimer(EngngModelTimerType t) { timers [ t ].resumeTimer(); }
132 void initTimer(EngngModelTimerType t) { timers [ t ].initTimer(); }
134
137
138 double getUtime(EngngModelTimerType t);
140 double getWtime(EngngModelTimerType t);
142 const Timer *getTimer(EngngModelTimerType t) { return timers + t; }
144 static void convert2HMS(int &nhrs, int &nmin, int &nsec, double tsec);
146 void toString(EngngModelTimerType t, char *buff);
148};
149} // end namespace oofem
150#endif // timer_h
Timer timers[EMTT_LastTimer]
Array of Timer classes.
Definition timer.h:120
void pauseTimer(EngngModelTimerType t)
Definition timer.h:130
const Timer * getTimer(EngngModelTimerType t)
Returns pointer to timer determined by EngngModelTimerType.
Definition timer.h:142
void initTimer(EngngModelTimerType t)
Definition timer.h:132
void startTimer(EngngModelTimerType t)
Definition timer.h:128
void stopTimer(EngngModelTimerType t)
Definition timer.h:129
void resumeTimer(EngngModelTimerType t)
Definition timer.h:131
std ::chrono ::time_point< std ::chrono ::high_resolution_clock > end_wtime
Definition timer.h:49
void resumeTimer()
Definition timer.C:91
std ::chrono ::duration< double > end_utime
Definition timer.h:51
std ::chrono ::duration< double > elapsedUTime
Definition timer.h:53
bool running
Flag indicating whether timer is running.
Definition timer.h:55
void pauseTimer()
Definition timer.C:83
std ::chrono ::duration< double > start_utime
User time.
Definition timer.h:51
std ::chrono ::duration< double > elapsedWTime
Accumulated wtime and utime (in seconds) from start.
Definition timer.h:53
void initTimer()
Definition timer.C:98
void startTimer()
Definition timer.C:69
void stopTimer()
Definition timer.C:77
bool isRunning()
Definition timer.h:65
std ::chrono ::time_point< std ::chrono ::high_resolution_clock > start_wtime
Wall clock time markers.
Definition timer.h:49
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011