Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::TimeStats Class Reference

Statistics on execution times. More...

#include <arcane/impl/TimeStats.h>

Inheritance diagram for Arcane::TimeStats:
Collaboration diagram for Arcane::TimeStats:

Classes

struct  TimeValue
class  PhaseValue
class  MetricCollector
class  Action
 Action. More...
class  ActionSeries
 Action series. More...

Public Types

enum  eTimeType { TT_Real = 0 , TT_Virtual }
using ActionList = List<Action*>

Public Member Functions

 TimeStats (ITimerMng *timer_mng, ITraceMng *trm, const String &name)
 TimeStats (const TimeStats &rhs)=delete
TimeStats & operator= (const TimeStats &rhs)=delete
void beginGatherStats () override
 Starts time collection.
void endGatherStats () override
 Stops time collection.
void beginAction (const String &action_name) override
void endAction (const String &action_name, bool print_time) override
void beginPhase (eTimePhase phase_type) override
void endPhase (eTimePhase phase_type) override
Real elapsedTime (eTimePhase phase) override
 Real elapsed time for phase phase.
Real elapsedTime (eTimePhase phase, const String &action) override
 Elapsed time for a phase of an action.
void dumpStats (std::ostream &ostr, bool is_verbose, Real nb, const String &name, bool use_elapsed_time) override
 Displays execution time statistics.
void dumpCurrentStats (const String &action) override
 Displays statistics for an action.
void dumpTimeAndMemoryUsage (IParallelMng *pm) override
 Displays the current date and memory consumption.
bool isGathering () const override
 Indicates if statistics are active.
void dumpStatsJSON (JSONWriter &writer) override
 Serializes the temporal statistics into the writer writer.
ITimeMetricCollectormetricCollector () override
 Associated collection interface.
void notifyNewIterationLoop () override
 Notifies that a new iteration of the calculation loop begins.
void saveTimeValues (Properties *p) override
void mergeTimeValues (Properties *p) override
void resetStats (const String &name) override
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const

Static Public Attributes

static const Integer NB_TIME_TYPE = 2
 Number of eTimeType values.
static const Integer TC_Local = 0
static const Integer TC_Cumulative = 1

Private Member Functions

Action_currentAction ()
PhaseValue _currentPhaseValue ()
void _checkGathering ()
void _computeCumulativeTimes ()
void _dumpCumulativeTime (std::ostream &ostr, Action &action, eTimePhase tp, eTimeType tt)
void _dumpAllPhases (std::ostream &ostr, Action &action, eTimeType tt, int tc, Real nb)

Private Attributes

ITimerMngm_timer_mng = nullptr
Timerm_virtual_timer = nullptr
Timerm_real_timer = nullptr
bool m_is_gathering = false
PhaseValue m_current_phase
ActionSeriesm_current_action_series = nullptr
 Statistics on current execution.
ActionSeriesm_previous_action_series = nullptr
 Statistics on previous executions.
Actionm_main_action = nullptr
Actionm_current_action = nullptr
std::stack< eTimePhasem_phases_type
bool m_need_compute_elapsed_time = false
std::ostringstream m_full_stats_str
bool m_full_stats = false
String m_name
ITimeMetricCollectorm_metric_collector = nullptr

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Statistics on execution times.

Definition at line 37 of file TimeStats.h.

Member Typedef Documentation

◆ ActionList

using Arcane::TimeStats::ActionList = List<Action*>

Definition at line 47 of file TimeStats.h.

Member Enumeration Documentation

◆ eTimeType

enum Arcane::TimeStats::eTimeType

Definition at line 49 of file TimeStats.h.

Constructor & Destructor Documentation

◆ TimeStats()

Arcane::TimeStats::TimeStats ( ITimerMng * timer_mng,
ITraceMng * trm,
const String & name )

Definition at line 260 of file TimeStats.cc.

◆ ~TimeStats()

Arcane::TimeStats::~TimeStats ( )
override

Definition at line 284 of file TimeStats.cc.

Member Function Documentation

◆ _checkGathering()

void Arcane::TimeStats::_checkGathering ( )
private

Definition at line 818 of file TimeStats.cc.

◆ _computeCumulativeTimes()

void Arcane::TimeStats::_computeCumulativeTimes ( )
private

Definition at line 643 of file TimeStats.cc.

◆ _currentAction()

TimeStats::Action * Arcane::TimeStats::_currentAction ( )
private

Definition at line 783 of file TimeStats.cc.

◆ _currentPhaseValue()

TimeStats::PhaseValue Arcane::TimeStats::_currentPhaseValue ( )
private

Definition at line 794 of file TimeStats.cc.

◆ _dumpCumulativeTime()

void Arcane::TimeStats::_dumpCumulativeTime ( std::ostream & ostr,
Action & action,
eTimePhase tp,
eTimeType tt )
private

Definition at line 676 of file TimeStats.cc.

◆ beginAction()

void Arcane::TimeStats::beginAction ( const String & action_name)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 358 of file TimeStats.cc.

◆ beginGatherStats()

void Arcane::TimeStats::beginGatherStats ( )
overridevirtual

Starts time collection.

Implements Arcane::ITimeStats.

Definition at line 299 of file TimeStats.cc.

References ARCANE_FATAL, Arcane::Timer::TimerReal, and Arcane::Timer::TimerVirtual.

◆ beginPhase()

void Arcane::TimeStats::beginPhase ( eTimePhase phase_type)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 395 of file TimeStats.cc.

◆ dumpCurrentStats()

void Arcane::TimeStats::dumpCurrentStats ( const String & name)
overridevirtual

Displays statistics for an action.

Displays the statistics for action name as well as its sub-actions for the current iteration.

Implements Arcane::ITimeStats.

Definition at line 535 of file TimeStats.cc.

References Arcane::TraceAccessor::info().

Here is the call graph for this function:

◆ dumpStats()

void Arcane::TimeStats::dumpStats ( std::ostream & ostr,
bool is_verbose,
Real nb,
const String & name,
bool use_elapsed_time )
overridevirtual

Displays execution time statistics.

It is possible to specify a value to get a time per iteration or per entity. If use_elapsed_time is true, it uses clock time; otherwise, it uses CPU time.

Implements Arcane::ITimeStats.

Definition at line 517 of file TimeStats.cc.

References m_current_action_series, and m_previous_action_series.

◆ dumpStatsJSON()

void Arcane::TimeStats::dumpStatsJSON ( JSONWriter & writer)
overridevirtual

Serializes the temporal statistics into the writer writer.

Implements Arcane::ITimeStats.

Definition at line 849 of file TimeStats.cc.

References m_current_action_series, and m_previous_action_series.

◆ dumpTimeAndMemoryUsage()

void Arcane::TimeStats::dumpTimeAndMemoryUsage ( IParallelMng * pm)
overridevirtual

Displays the current date and memory consumption.

This operation is collective on pm.

This operation displays the memory consumed for the current subdomain as well as the min and max for all subdomains.

Implements Arcane::ITimeStats.

Definition at line 840 of file TimeStats.cc.

References Arcane::MessagePassing::dumpDateAndMemoryUsage(), and Arcane::TraceAccessor::traceMng().

Here is the call graph for this function:

◆ elapsedTime() [1/2]

Real Arcane::TimeStats::elapsedTime ( eTimePhase phase)
overridevirtual

Real elapsed time for phase phase.

Returns the real elapsed time (in seconds) for phase phase.

Implements Arcane::ITimeStats.

Definition at line 426 of file TimeStats.cc.

◆ elapsedTime() [2/2]

Real Arcane::TimeStats::elapsedTime ( eTimePhase phase,
const String & action )
overridevirtual

Elapsed time for a phase of an action.

Returns the real elapsed time (in seconds) for phase phase of action action. The returned time includes that of the action and all of its children.

Implements Arcane::ITimeStats.

Definition at line 436 of file TimeStats.cc.

References Arcane::TraceAccessor::info().

Here is the call graph for this function:

◆ endAction()

void Arcane::TimeStats::endAction ( const String & action_name,
bool print_time )
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 374 of file TimeStats.cc.

◆ endGatherStats()

void Arcane::TimeStats::endGatherStats ( )
overridevirtual

Stops time collection.

Implements Arcane::ITimeStats.

Definition at line 323 of file TimeStats.cc.

References Arcane::String::localstr().

Here is the call graph for this function:

◆ endPhase()

void Arcane::TimeStats::endPhase ( eTimePhase phase_type)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 408 of file TimeStats.cc.

◆ isGathering()

bool Arcane::TimeStats::isGathering ( ) const
overridevirtual

Indicates if statistics are active.

Statistics are active between the call to beginGatherStats() and endGatherStats().

Implements Arcane::ITimeStats.

Definition at line 830 of file TimeStats.cc.

◆ mergeTimeValues()

void Arcane::TimeStats::mergeTimeValues ( Properties * p)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 1034 of file TimeStats.cc.

◆ metricCollector()

ITimeMetricCollector * Arcane::TimeStats::metricCollector ( )
overridevirtual

Associated collection interface.

Implements Arcane::ITimeStats.

Definition at line 1002 of file TimeStats.cc.

◆ notifyNewIterationLoop()

void Arcane::TimeStats::notifyNewIterationLoop ( )
overridevirtual

Notifies that a new iteration of the calculation loop begins.

This information is used to calculate times per iteration.

Implements Arcane::ITimeStats.

Definition at line 1066 of file TimeStats.cc.

References m_current_action_series.

◆ resetStats()

void Arcane::TimeStats::resetStats ( const String & name)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 553 of file TimeStats.cc.

◆ saveTimeValues()

void Arcane::TimeStats::saveTimeValues ( Properties * p)
overridevirtual

Implements Arcane::ITimeStats.

Definition at line 1011 of file TimeStats.cc.

Member Data Documentation

◆ m_current_action

Action* Arcane::TimeStats::m_current_action = nullptr
private

Definition at line 163 of file TimeStats.h.

◆ m_current_action_series

ActionSeries* Arcane::TimeStats::m_current_action_series = nullptr
private

Statistics on current execution.

Definition at line 159 of file TimeStats.h.

Referenced by dumpStats(), dumpStatsJSON(), and notifyNewIterationLoop().

◆ m_current_phase

PhaseValue Arcane::TimeStats::m_current_phase
private

Definition at line 157 of file TimeStats.h.

◆ m_full_stats

bool Arcane::TimeStats::m_full_stats = false
private

Definition at line 167 of file TimeStats.h.

◆ m_full_stats_str

std::ostringstream Arcane::TimeStats::m_full_stats_str
private

Definition at line 166 of file TimeStats.h.

◆ m_is_gathering

bool Arcane::TimeStats::m_is_gathering = false
private

Definition at line 156 of file TimeStats.h.

◆ m_main_action

Action* Arcane::TimeStats::m_main_action = nullptr
private

Definition at line 162 of file TimeStats.h.

◆ m_metric_collector

ITimeMetricCollector* Arcane::TimeStats::m_metric_collector = nullptr
private

Definition at line 169 of file TimeStats.h.

◆ m_name

String Arcane::TimeStats::m_name
private

Definition at line 168 of file TimeStats.h.

◆ m_need_compute_elapsed_time

bool Arcane::TimeStats::m_need_compute_elapsed_time = false
private

Definition at line 165 of file TimeStats.h.

◆ m_phases_type

std::stack<eTimePhase> Arcane::TimeStats::m_phases_type
private

Definition at line 164 of file TimeStats.h.

◆ m_previous_action_series

ActionSeries* Arcane::TimeStats::m_previous_action_series = nullptr
private

Statistics on previous executions.

Definition at line 161 of file TimeStats.h.

Referenced by dumpStats(), and dumpStatsJSON().

◆ m_real_timer

Timer* Arcane::TimeStats::m_real_timer = nullptr
private

Definition at line 155 of file TimeStats.h.

◆ m_timer_mng

ITimerMng* Arcane::TimeStats::m_timer_mng = nullptr
private

Definition at line 153 of file TimeStats.h.

◆ m_virtual_timer

Timer* Arcane::TimeStats::m_virtual_timer = nullptr
private

Definition at line 154 of file TimeStats.h.

◆ NB_TIME_TYPE

const Integer Arcane::TimeStats::NB_TIME_TYPE = 2
static

Number of eTimeType values.

Definition at line 56 of file TimeStats.h.

Referenced by Arcane::TimeStats::Action::reset().

◆ TC_Cumulative

const Integer Arcane::TimeStats::TC_Cumulative = 1
static

Definition at line 59 of file TimeStats.h.

◆ TC_Local

const Integer Arcane::TimeStats::TC_Local = 0
static

Definition at line 58 of file TimeStats.h.


The documentation for this class was generated from the following files: