14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/String.h"
18#include "arcane/utils/TraceInfo.h"
19#include "arcane/utils/FatalErrorException.h"
20#include "arcane/utils/ITraceMng.h"
21#include "arcane/utils/Iostream.h"
23#include "arcane/Timer.h"
24#include "arcane/ISubDomain.h"
25#include "arcane/ITimerMng.h"
26#include "arcane/ITimeStats.h"
28#include "arccore/trace/TimeMetric.h"
40:
Timer(sd->timerMng(),name,type)
52, m_is_activated(false)
53, m_activation_time(0.0)
78 m_activation_time = 0.;
82 m_is_activated =
true;
92 m_activation_time = m_timer_mng->
endTimer(
this);
93 m_is_activated =
false;
94 m_total_time += m_activation_time;
98 return m_activation_time;
104 m_is_activated =
false;
105 m_activation_time = 0.0;
126 m_stats->beginAction(m_action_name);
133Action(ISubDomain* sub_domain,
const String& action_name,
bool print_time)
135, m_action_name(action_name)
136, m_print_time(print_time)
139 m_stats = sub_domain->timeStats();
147Action(ITimeStats* stats,
const String& action_name,
bool print_time)
149, m_action_name(action_name)
150, m_print_time(print_time)
162 m_stats->endAction(m_action_name,m_print_time);
175 if (!m_stats->isGathering())
178 m_stats->beginPhase(m_phase_type);
190 m_stats = sub_domain->timeStats();
212 m_stats->endPhase(m_phase_type);
221Timer::SimplePrinter::
222SimplePrinter(ITraceMng* tm,
const String& msg)
234Timer::SimplePrinter::
235SimplePrinter(ITraceMng* tm,
const String& msg,
bool is_active)
238, m_is_active(is_active)
247Timer::SimplePrinter::
251 Real end_time = platform::getRealTime();
252 Real diff_time = end_time - m_begin_time;
253 m_trace_mng->
info() << m_message <<
" time=" << diff_time;
260void Timer::SimplePrinter::
264 m_begin_time = platform::getRealTime();
270TimeMetricAction Timer::
273 ITimeMetricCollector* c =
nullptr;
275 c = s->metricCollector();
277 return TimeMetricAction();
278 return TimeMetricAction(c,TimeMetricActionBuildInfo(String(),phase));
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Interface du gestionnaire d'un sous-domaine.
virtual bool isGathering() const =0
Indique si les statistiques sont actives.
Interface d'un gestionnaire de timer.
virtual Real endTimer(Timer *timer)=0
Relâche le timer timer.
virtual void beginTimer(Timer *timer)=0
Attache le timer timer à ce gestionnaire.
Real stop()
Désactive le timer.
~Timer()
Libère les ressources.
Timer(ISubDomain *sd, const String &name, eTimerType type)
Construit un timer.
void reset()
Remet à zéro les compteurs de temps.
void start()
Active le timer.
virtual TraceMessage info()=0
Flot pour un message d'information.
Chaîne de caractères unicode.
eTimePhase
Phase d'une action temporelle.
double Real
Type représentant un réel.