KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Classes | List of all members
Kratos::Timer Class Reference

This utility can be used to compute the time employed on computations. More...

#include <timer.h>

Collaboration diagram for Kratos::Timer:

Public Member Functions

Life Cycle
 Timer ()
 Default constructor. More...
 
virtual ~Timer ()
 Destructor. More...
 

Static Public Member Functions

Operations
static void Start (std::string const &rIntervalName)
 This method starts the timer meassures. More...
 
static void Stop (std::string const &rIntervalName)
 This method stops the timer meassures. More...
 
static double GetTime ()
 This method returns the resulting time. More...
 
static double ElapsedSeconds (const std::chrono::steady_clock::time_point StartTime)
 This method returns the resulting time. More...
 
Access
static int SetOuputFile (std::string const &rOutputFileName)
 This method sets the output file *.time that will store the timing. More...
 
static int CloseOuputFile ()
 This method closes the output file. More...
 
static bool GetPrintOnScreen ()
 This method gets the variable which stores if the information is printed on screen. More...
 
static void SetPrintOnScreen (bool const PrintOnScreen)
 This method sets the variable which stores if the information is printed on screen. More...
 
static bool GetPrintIntervalInformation ()
 This method gets the variable which stores if the information is printed on each interval. More...
 
static void SetPrintIntervalInformation (bool const PrintIntervalInformation)
 This method sets the variable which stores if the information is printed on each interval. More...
 

Type Definitions

typedef double TimeType
 The type of float used to store the time. More...
 
typedef std::map< std::string, TimerData > ContainerType
 The timer data container type (map) More...
 
typedef std::unordered_map< std::string, std::string > InternalNameDatabaseType
 This is used to know the internal name used for the time table. More...
 
static constexpr std::size_t NumberOfZeros = 3
 The number of 0 in the internal name. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (Timer)
 Pointer definition of Timer. More...
 

Input and output

virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 
static void PrintIntervalInformation (std::ostream &rOStream, std::string const &rIntervalName, const double StartTime, const double StopTime)
 This method prints the internal information in a given stream. More...
 
static void PrintIntervalInformation (std::string const &rIntervalName, const double StartTime, const double StopTime)
 This method prints the internal information. More...
 
static void PrintTimingInformation ()
 This method prints the timing information. More...
 
static void PrintTimingInformation (std::ostream &rOStream)
 This method prints the timing information in a giving stream. More...
 

Detailed Description

This utility can be used to compute the time employed on computations.

Author
Pooyan Dadvand
Riccardo Rossi
Vicente Mataix Ferrandiz

Member Typedef Documentation

◆ ContainerType

typedef std::map<std::string, TimerData> Kratos::Timer::ContainerType

The timer data container type (map)

◆ InternalNameDatabaseType

typedef std::unordered_map<std::string, std::string> Kratos::Timer::InternalNameDatabaseType

This is used to know the internal name used for the time table.

◆ TimeType

The type of float used to store the time.

Constructor & Destructor Documentation

◆ Timer()

Kratos::Timer::Timer ( )

Default constructor.

◆ ~Timer()

virtual Kratos::Timer::~Timer ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ CloseOuputFile()

int Kratos::Timer::CloseOuputFile ( )
static

This method closes the output file.

◆ ElapsedSeconds()

static double Kratos::Timer::ElapsedSeconds ( const std::chrono::steady_clock::time_point  StartTime)
inlinestatic

This method returns the resulting time.

◆ GetPrintIntervalInformation()

bool Kratos::Timer::GetPrintIntervalInformation ( )
static

This method gets the variable which stores if the information is printed on each interval.

Returns
True if the information is printed on each interval, false otherwise

◆ GetPrintOnScreen()

bool Kratos::Timer::GetPrintOnScreen ( )
static

This method gets the variable which stores if the information is printed on screen.

Returns
True if the information is printed on screen, false otherwise

◆ GetTime()

static double Kratos::Timer::GetTime ( )
inlinestatic

This method returns the resulting time.

◆ Info()

virtual std::string Kratos::Timer::Info ( ) const
inlinevirtual

Turn back information as a string.

◆ KRATOS_CLASS_POINTER_DEFINITION()

Kratos::Timer::KRATOS_CLASS_POINTER_DEFINITION ( Timer  )

Pointer definition of Timer.

◆ PrintData()

virtual void Kratos::Timer::PrintData ( std::ostream &  rOStream) const
inlinevirtual

Print object's data.

◆ PrintInfo()

virtual void Kratos::Timer::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Print information about this object.

◆ PrintIntervalInformation() [1/2]

void Kratos::Timer::PrintIntervalInformation ( std::ostream &  rOStream,
std::string const &  rIntervalName,
const double  StartTime,
const double  StopTime 
)
static

This method prints the internal information in a given stream.

Parameters
rOStreamThe strem considered
rIntervalNameThe internal name that will store the timing data
StartTimeThe starting time
StopTimeThe stoping time

◆ PrintIntervalInformation() [2/2]

void Kratos::Timer::PrintIntervalInformation ( std::string const &  rIntervalName,
const double  StartTime,
const double  StopTime 
)
static

This method prints the internal information.

Parameters
rIntervalNameThe internal name that will store the timing data
StartTimeThe starting time
StopTimeThe stoping time

◆ PrintTimingInformation() [1/2]

void Kratos::Timer::PrintTimingInformation ( )
static

This method prints the timing information.

◆ PrintTimingInformation() [2/2]

void Kratos::Timer::PrintTimingInformation ( std::ostream &  rOStream)
static

This method prints the timing information in a giving stream.

Parameters
rOStreamThe strem considered

◆ SetOuputFile()

int Kratos::Timer::SetOuputFile ( std::string const &  rOutputFileName)
static

This method sets the output file *.time that will store the timing.

Parameters
rOutputFileNameThe name of the output file

◆ SetPrintIntervalInformation()

void Kratos::Timer::SetPrintIntervalInformation ( bool const  PrintIntervalInformation)
static

This method sets the variable which stores if the information is printed on each interval.

Parameters
PrintIntervalInformationTrue if the information is printed on each interval, false otherwise

◆ SetPrintOnScreen()

void Kratos::Timer::SetPrintOnScreen ( bool const  PrintOnScreen)
static

This method sets the variable which stores if the information is printed on screen.

Parameters
PrintOnScreenTrue if the information is printed on screen, false otherwise

◆ Start()

void Kratos::Timer::Start ( std::string const &  rIntervalName)
static

This method starts the timer meassures.

Parameters
rIntervalNameThe internal name that will store the timing data

◆ Stop()

void Kratos::Timer::Stop ( std::string const &  rIntervalName)
static

This method stops the timer meassures.

Parameters
rIntervalNameThe internal name that will store the timing data

Member Data Documentation

◆ NumberOfZeros

constexpr std::size_t Kratos::Timer::NumberOfZeros = 3
staticconstexpr

The number of 0 in the internal name.


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