FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::TimeStamp Class Reference

Time stamp class. More...

#include <time_stamp.hpp>

Public Member Functions

 TimeStamp ()
 Constructor. More...
 
double elapsed (const TimeStamp &before) const
 Calculates the time elapsed between two time stamps. More...
 
long long elapsed_micros (const TimeStamp &before) const
 Calculate the time elapsed between two time stamps in microseconds. More...
 
long long elapsed_micros_now () const
 Calculates the time elapsed between the time stamp and now in microseconds. More...
 
double elapsed_now () const
 Calculates the time elapsed between the time stamp and now. More...
 
String elapsed_string (const TimeStamp &before, TimeFormat format=TimeFormat::s_m) const
 Return the time elapsed between two time stamps as a string. More...
 
String elapsed_string_now (TimeFormat format=TimeFormat::s_m) const
 Calculates the time elapsed between the time stamp and now as a string. More...
 
bool operator< (const TimeStamp &other) const
 Comparison operator. More...
 
TimeStampstamp ()
 Stamps the current time-stamp. More...
 

Static Public Member Functions

static String format_micros (long long micros, TimeFormat format=TimeFormat::s_m)
 Formats an elapsed time in microseconds as a string. More...
 

Private Attributes

clock_t _clock
 Our time-stamp. More...
 

Detailed Description

Time stamp class.

This class is used to store time stamps and compute elapsed times. The implementation of this class depends on the current platform:

  • For unix/linux systems, this class makes use of the gettimeofday() function.
  • For Windows systems, this class makes use of the QueryPerformanceCounter() function.
  • For other systems, this class makes use of the ANSI-C clock() function as a fallback implementation.
Platform dependend code branching:
Windows does not use gettimeofday
Author
Dirk Ribbrock
Peter Zajac

Definition at line 53 of file time_stamp.hpp.

Constructor & Destructor Documentation

◆ TimeStamp()

FEAT::TimeStamp::TimeStamp ( )
inline

Constructor.

Definition at line 67 of file time_stamp.hpp.

References stamp().

Referenced by elapsed_micros_now(), elapsed_now(), and elapsed_string_now().

Member Function Documentation

◆ elapsed()

double FEAT::TimeStamp::elapsed ( const TimeStamp before) const
inline

Calculates the time elapsed between two time stamps.

Parameters
[in]beforeA time stamp that represents a previous moment.
Returns
The time elapsed between the time stamps before and this in seconds.

Definition at line 100 of file time_stamp.hpp.

References _clock, and FEAT::Windows::query_performance_frequency().

Referenced by FEAT::Solver::MultiGrid< SystemMatrix_, SystemFilter_, TransferOperator_ >::_apply_smooth_peak(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::apply(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::apply(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::apply(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::apply(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::apply(), FEAT::Solver::ILUPrecondWithBackend< PreferredBackend::generic, LAFEM::SparseMatrixCSR< DT_, IT_ >, Filter_ >::apply(), FEAT::Solver::ILUPrecondWithBackend< PreferredBackend::generic, LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, dim_ >, Filter_ >::apply(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::apply_transposed(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::apply_transposed(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::apply_transposed(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::apply_transposed(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::apply_transposed(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::axpy(), FEAT::LAFEM::DenseVector< DT_, IT_ >::axpy(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::axpy(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::axpy(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::axpy(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::axpy(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::axpy(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::axpy_blocked(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::component_copy(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::component_copy_to(), FEAT::LAFEM::DenseVector< DT_, IT_ >::component_invert(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::component_invert(), FEAT::LAFEM::DenseVector< DT_, IT_ >::component_product(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::component_product(), FEAT::LAFEM::DenseVector< DT_, IT_ >::dot(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::dot(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::dot_blocked(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::invert(), FEAT::LAFEM::DenseVector< DT_, IT_ >::max_abs_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::max_abs_element(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::max_abs_element(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::max_abs_element(), FEAT::LAFEM::SparseVector< DT_, IT_ >::max_abs_element(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::max_abs_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::max_abs_element_blocked(), FEAT::LAFEM::DenseVector< DT_, IT_ >::max_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::max_element(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::max_element(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::max_element(), FEAT::LAFEM::SparseVector< DT_, IT_ >::max_element(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::max_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::max_element_blocked(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::DenseVector< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::max_rel_diff(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::max_rel_diff(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::SparseVector< DT_, IT_ >::max_rel_diff(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::max_rel_diff(), FEAT::LAFEM::DenseVector< DT_, IT_ >::min_abs_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::min_abs_element(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::min_abs_element(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::min_abs_element(), FEAT::LAFEM::SparseVector< DT_, IT_ >::min_abs_element(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::min_abs_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::min_abs_element_blocked(), FEAT::LAFEM::DenseVector< DT_, IT_ >::min_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::min_element(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::min_element(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::min_element(), FEAT::LAFEM::SparseVector< DT_, IT_ >::min_element(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::min_element(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::min_element_blocked(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::multiply(), FEAT::LAFEM::DenseVector< DT_, IT_ >::norm2(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::norm2(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::norm2_blocked(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::norm2sqr_blocked(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::norm_frobenius(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::norm_frobenius(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::norm_frobenius(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::norm_frobenius(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::norm_frobenius(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::row_norm2(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::row_norm2(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::row_norm2sqr(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::row_norm2sqr(), FEAT::LAFEM::DenseMatrix< DT_, IT_ >::scale(), FEAT::LAFEM::DenseVector< DT_, IT_ >::scale(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::scale(), FEAT::LAFEM::SparseMatrixBanded< DT_, IT_ >::scale(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::scale(), FEAT::LAFEM::SparseMatrixCSCR< DT_, IT_ >::scale(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::scale(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::scale_blocked(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::scale_cols(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::scale_rows(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::scale_rows(), FEAT::LAFEM::DenseVector< DT_, IT_ >::triple_dot(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::triple_dot(), and FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::triple_dot_blocked().

◆ elapsed_micros()

long long FEAT::TimeStamp::elapsed_micros ( const TimeStamp before) const
inline

Calculate the time elapsed between two time stamps in microseconds.

Parameters
[in]beforeA time stamp that represents a previous moment.
Returns
The time elapsed between the time stamps before and this in microseconds.

Definition at line 135 of file time_stamp.hpp.

References _clock, and FEAT::Windows::query_performance_frequency().

Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_colored(), FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_layered(), FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_no_scatter(), FEAT::StopWatch::elapsed_micros(), elapsed_string(), and FEAT::StopWatch::stop().

◆ elapsed_micros_now()

long long FEAT::TimeStamp::elapsed_micros_now ( ) const
inline

Calculates the time elapsed between the time stamp and now in microseconds.

Note
This function does not update (stamp) this time stamp.
Returns
The time elapsed between this time stamp and now in microseconds.

Definition at line 157 of file time_stamp.hpp.

References TimeStamp().

Referenced by FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_colored(), FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_layered(), FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_no_scatter(), FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::_work_single(), and FEAT::Assembly::DomainAssembler< Trafo_ >::Worker< Job_ >::operator()().

◆ elapsed_now()

double FEAT::TimeStamp::elapsed_now ( ) const
inline

◆ elapsed_string()

String FEAT::TimeStamp::elapsed_string ( const TimeStamp before,
TimeFormat  format = TimeFormat::s_m 
) const
inline

Return the time elapsed between two time stamps as a string.

See TimeStamp::format_micros() for more information about the formatting options.

Parameters
[in]beforeA time stamp that represents a previous moment.
[in]formatSpecifies string formatting to be used.
Returns
The time elapsed between the time stamps before and this as a formatted string, for example h:mm:ss.mm.

Definition at line 253 of file time_stamp.hpp.

References elapsed_micros(), and format_micros().

◆ elapsed_string_now()

String FEAT::TimeStamp::elapsed_string_now ( TimeFormat  format = TimeFormat::s_m) const
inline

Calculates the time elapsed between the time stamp and now as a string.

Note
This function does not update (stamp) this time stamp.

See TimeStamp::format_micros() for more information about the formatting options.

Parameters
[in]formatSpecifies string formatting to be used.
Returns
The time elapsed between this time stamp and now as a formatted string, for example h:mm:ss.mm.

Definition at line 273 of file time_stamp.hpp.

References TimeStamp().

◆ format_micros()

static String FEAT::TimeStamp::format_micros ( long long  micros,
TimeFormat  format = TimeFormat::s_m 
)
inlinestatic

Formats an elapsed time in microseconds as a string.

This function formats the given elapsed time as a string, where the format depends on the TimeFormat parameter:

Parameters
[in]microsThe elapsed time to be formatted.
[in]formatSpecifies string formatting to be used.
Returns
The time elapsed as a formatted string, for example h:m:ss.mmm.

Definition at line 187 of file time_stamp.hpp.

References FEAT::h_m_s, FEAT::h_m_s_m, FEAT::m_s, FEAT::m_s_m, FEAT::s_m, and XABORTM.

Referenced by elapsed_string(), and FEAT::StopWatch::elapsed_string().

◆ operator<()

bool FEAT::TimeStamp::operator< ( const TimeStamp other) const
inline

Comparison operator.

Parameters
[in]otherAnother time-stamp.
Returns
true, if this time-stamp has been taken earlier than other, otherwise false.

Definition at line 287 of file time_stamp.hpp.

References _clock.

◆ stamp()

Member Data Documentation

◆ _clock

clock_t FEAT::TimeStamp::_clock
private

Our time-stamp.

Definition at line 62 of file time_stamp.hpp.

Referenced by elapsed(), elapsed_micros(), operator<(), and stamp().


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