Scippy

UG

Ubiquity Generator framework

paraTimerTh.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file paraTimerTh.h
27 * @brief ParaTimer extension for threads.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#ifndef __PARA_TIMER_TH_H__
38#define __PARA_TIMER_TH_H__
39#include "paraTimer.h"
40#include "paraSysTimer.h"
41
42namespace UG
43{
44
45///
46/// class ParaTimerMpi
47/// (Timer used in thread communication)
48///
49class ParaTimerTh : public ParaTimer
50{
51
52 ParaSysTimer timer; ///< system timer
53
54public:
55
56 ///
57 /// default constructor
58 ///
60 )
61 {
62 }
63
64 ///
65 /// destructor
66 ///
68 )
69 {
70 }
71
72 ///
73 /// initialize timer
74 ///
75 void init(
76 ParaComm *comm ///< communicator used
77 )
78 {
79 timer.start();
80 }
81
82 ///
83 /// get elapsed time
84 /// @return elapsed time
85 ///
87 )
88 {
89 return (timer.getRTimeInterval() + offset);
90 }
91
92};
93
94}
95
96#endif // __PARA_TIMER_TH_H__
Base class of communicator object.
Definition: paraComm.h:102
Class ParaSysTimer.
Definition: paraSysTimer.h:107
double getRTimeInterval(void)
get elapsed time from start time
void start(void)
start timer
class ParaTimerMpi (Timer used in thread communication)
Definition: paraTimerTh.h:50
~ParaTimerTh()
destructor
Definition: paraTimerTh.h:67
ParaSysTimer timer
system timer
Definition: paraTimerTh.h:52
double getElapsedTime()
get elapsed time
Definition: paraTimerTh.h:86
void init(ParaComm *comm)
initialize timer
Definition: paraTimerTh.h:75
ParaTimerTh()
default constructor
Definition: paraTimerTh.h:59
class ParaTimer
Definition: paraTimer.h:49
double offset
offset of start time
Definition: paraTimer.h:53
static ScipParaCommTh * comm
Definition: fscip.cpp:73
System timer.
Base class for Timer.