Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
LUPI::DeltaTime Class Reference

#include <LUPI.hpp>

Public Member Functions

 DeltaTime ()
 DeltaTime (double a_CPU_time, double a_wallTime, double a_CPU_timeIncremental, double a_wallTimeIncremental)
 DeltaTime (DeltaTime const &deltaTime)
 ~DeltaTime ()
double CPU_time () const
double wallTime () const
double CPU_timeIncremental () const
double wallTimeIncremental () const
std::string toString (std::string a_formatIncremental=LUPI_DeltaTime_toStringFormatIncremental, std::string a_format=LUPI_DeltaTime_toStringFormatTotal, std::string a_sep="; ")

Detailed Description

Definition at line 346 of file LUPI.hpp.

Constructor & Destructor Documentation

◆ DeltaTime() [1/3]

LUPI::DeltaTime::DeltaTime ( )

Default constructor for DeltaTime which sets all values to 0.0.

Definition at line 27 of file LUPI_times.cc.

27 :
28 m_CPU_time( 0.0 ),
29 m_wallTime( 0.0 ),
30 m_CPU_timeIncremental( 0.0 ),
31 m_wallTimeIncremental( 0.0 ) {
32
33}

Referenced by DeltaTime().

◆ DeltaTime() [2/3]

LUPI::DeltaTime::DeltaTime ( double a_CPU_time,
double a_wallTime,
double a_CPU_timeIncremental,
double a_wallTimeIncremental )

Constructor for DeltaTime which contains the CPU time a_CPU_time and wall time a_wallTime.

Definition at line 39 of file LUPI_times.cc.

39 :
40 m_CPU_time( a_CPU_time ),
41 m_wallTime( a_wallTime ),
42 m_CPU_timeIncremental( a_CPU_timeIncremental ),
43 m_wallTimeIncremental( a_wallTimeIncremental ) {
44
45}

◆ DeltaTime() [3/3]

LUPI::DeltaTime::DeltaTime ( DeltaTime const & deltaTime)

Copy constructor for DeltaTime.

Definition at line 51 of file LUPI_times.cc.

51 :
52 m_CPU_time( deltaTime.CPU_time( ) ),
53 m_wallTime( deltaTime.wallTime( ) ),
54 m_CPU_timeIncremental( deltaTime.CPU_timeIncremental( ) ),
55 m_wallTimeIncremental( deltaTime.wallTimeIncremental( ) ) {
56
57}

◆ ~DeltaTime()

LUPI::DeltaTime::~DeltaTime ( )
inline

Definition at line 358 of file LUPI.hpp.

358{ }

Member Function Documentation

◆ CPU_time()

double LUPI::DeltaTime::CPU_time ( ) const
inline

Definition at line 360 of file LUPI.hpp.

360{ return( m_CPU_time ); }

Referenced by DeltaTime().

◆ CPU_timeIncremental()

double LUPI::DeltaTime::CPU_timeIncremental ( ) const
inline

Definition at line 362 of file LUPI.hpp.

362{ return( m_CPU_timeIncremental ); }

Referenced by DeltaTime().

◆ toString()

std::string LUPI::DeltaTime::toString ( std::string a_formatIncremental = LUPI_DeltaTime_toStringFormatIncremental,
std::string a_formatTotal = LUPI_DeltaTime_toStringFormatTotal,
std::string a_sep = "; " )

Returns a string representation of this. The arugments a_formatIncremental and a_format specify, in sprintf style, the formats for the incremental and total times. If an arugment is an empty string (e.g., "") then its time is not included in the return string. Each non-empty argument must contain two flags (e.g., "%.3f") for converting two doubles. If both formats are non-empty strings, then a_sep is inserted between them. An example of a format string is "total: CPU %8.3f, wall %8.3f".

Parameters
a_formatIncremental[in] Specifies the format in sprintf style for the incremental CPU and wall times.
a_formatTotal[in] Specifies the format in sprintf style for the total CPU and wall times.
a_sep[in] Specifies the string that separates the total and incremental time strings.
Returns
A string representation of the delta times.

Definition at line 72 of file LUPI_times.cc.

72 {
73
74 std::string deltaTimeStr;
75 char buffer[bufferSize+1];
76
77 if( a_formatIncremental != "" ) {
78 snprintf( buffer, bufferSize, a_formatIncremental.c_str( ), m_CPU_timeIncremental, m_wallTimeIncremental );
79 deltaTimeStr += buffer;
80 }
81
82 if( a_formatTotal != "" ) {
83 if( deltaTimeStr != "" ) deltaTimeStr += a_sep;
84 snprintf( buffer, bufferSize, a_formatTotal.c_str( ), m_CPU_time, m_wallTime );
85 deltaTimeStr += buffer;
86 }
87
88 return( deltaTimeStr );
89}
#define bufferSize
Definition LUPI_times.cc:21

◆ wallTime()

double LUPI::DeltaTime::wallTime ( ) const
inline

Definition at line 361 of file LUPI.hpp.

361{ return( m_wallTime ); }

Referenced by DeltaTime().

◆ wallTimeIncremental()

double LUPI::DeltaTime::wallTimeIncremental ( ) const
inline

Definition at line 363 of file LUPI.hpp.

363{ return( m_wallTimeIncremental ); }

Referenced by DeltaTime().


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