Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
TimerMng.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* TimerMng.cc (C) 2000-2022 */
9/* */
10/* Implémentation d'un gestionnaire de timer. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/impl/TimerMng.h"
15
16#include "arcane/utils/Iterator.h"
17#include "arcane/utils/FatalErrorException.h"
18#include "arcane/utils/ITraceMng.h"
19#include "arcane/utils/TraceInfo.h"
20#include "arcane/utils/PlatformUtils.h"
21
22#include "arcane/ArcaneException.h"
23#include "arcane/Timer.h"
24#include "arcane/ISubDomain.h"
25#include "arcane/IMainFactory.h"
26
27#include <algorithm>
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
39TimerMng(ITraceMng* trace)
40: TraceAccessor(trace)
41{
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
52{
53 Real tvalue = _getRealTime();
54 timer->_setStartTime(tvalue);
55}
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
62{
63 Real tvalue = _getRealTime();
64 Real active_value = tvalue - timer->_startTime();
65 return active_value;
66}
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70
73{
74 Real tvalue = _getRealTime();
75 Real active_value = tvalue - timer->_startTime();
76 return active_value;
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
84{
85 return timer->timerMng()==this && timer->isActivated();
86}
87
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
91
94{
95 return platform::getRealTime();
96}
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101/*---------------------------------------------------------------------------*/
102/*---------------------------------------------------------------------------*/
103
104void TimerMng::
105_errorInTimer(const String& msg,int retcode)
106{
107 warning() << "In TimerMng::_errorInTimer() "
108 << msg << " return code: " << retcode << " errno: " << errno;
109}
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114} // End namespace Arcane
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
bool hasTimer(Timer *timer) override
Indique si le timer timer est enregistré.
Definition TimerMng.cc:83
TimerMng(ITraceMng *msg)
Construit un timer lié au gestionnaire mng.
Definition TimerMng.cc:39
virtual Real _getRealTime()
Retourne le temps réel.
Definition TimerMng.cc:93
Real getTime(Timer *timer) override
Temps écoulé depuis le dernier appel à beginTimer().
Definition TimerMng.cc:61
void beginTimer(Timer *timer) override
Attache le timer timer à ce gestionnaire.
Definition TimerMng.cc:51
Real endTimer(Timer *timer) override
Relâche le timer timer.
Definition TimerMng.cc:72
Gestion d'un timer.
Definition Timer.h:62
Interface du gestionnaire de traces.
Chaîne de caractères unicode.
TraceMessage warning() const
Flot pour un message d'avertissement.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-