timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::component::ert_timer Struct Reference

#include "timemory/components/timing/ert_timer.hpp"

+ Collaboration diagram for tim::component::ert_timer:

Public Types

using ratio_t = std::nano
 
using value_type = int64_t
 
using this_type = ert_timer
 
using fmtflags = std::ios_base::fmtflags
 

Public Member Functions

auto load () const
 
double get () const noexcept
 
auto get_display () const noexcept
 
void start () noexcept
 
void stop () noexcept
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
void print (std::ostream &os) const
 

Static Public Member Functions

static std::string get_label ()
 
static std::string get_description ()
 
static int64_t get_unit ()
 
static std::string get_display_unit ()
 
static auto get_width ()
 
static auto get_precision ()
 
static auto get_format_flags ()
 
static value_type record () noexcept
 

Static Public Attributes

static const short precision = 3
 
static const short width = 8
 
static const fmtflags format_flags
 

Friends

std::ostream & operator<< (std::ostream &os, const this_type &obj)
 

Detailed Description

Definition at line 40 of file ert_timer.hpp.

Member Typedef Documentation

◆ fmtflags

using tim::component::ert_timer::fmtflags = std::ios_base::fmtflags

Definition at line 45 of file ert_timer.hpp.

◆ ratio_t

Definition at line 42 of file ert_timer.hpp.

◆ this_type

Definition at line 44 of file ert_timer.hpp.

◆ value_type

Definition at line 43 of file ert_timer.hpp.

Member Function Documentation

◆ get()

double tim::component::ert_timer::get ( ) const
inlinenoexcept

Definition at line 68 of file ert_timer.hpp.

68{ return load() / static_cast<double>(get_unit()); }
static int64_t get_unit()
Definition: ert_timer.hpp:54

References get_unit(), and load().

Referenced by get_display().

◆ get_description()

static std::string tim::component::ert_timer::get_description ( )
inlinestatic

Definition at line 53 of file ert_timer.hpp.

53{ return "wall-clock timer for ERT"; }

◆ get_display()

auto tim::component::ert_timer::get_display ( ) const
inlinenoexcept

Definition at line 70 of file ert_timer.hpp.

70{ return get(); }
double get() const noexcept
Definition: ert_timer.hpp:68

References get().

◆ get_display_unit()

static std::string tim::component::ert_timer::get_display_unit ( )
inlinestatic

Definition at line 55 of file ert_timer.hpp.

55{ return units::time_repr(units::sec); }
std::string time_repr(int64_t _unit)
Definition: units.hpp:145

References tim::units::time_repr().

◆ get_format_flags()

static auto tim::component::ert_timer::get_format_flags ( )
inlinestatic

Definition at line 59 of file ert_timer.hpp.

59{ return format_flags; }
static const fmtflags format_flags
Definition: ert_timer.hpp:49

References format_flags.

◆ get_label()

static std::string tim::component::ert_timer::get_label ( )
inlinestatic

Definition at line 52 of file ert_timer.hpp.

52{ return "wall"; }

◆ get_precision()

static auto tim::component::ert_timer::get_precision ( )
inlinestatic

Definition at line 58 of file ert_timer.hpp.

58{ return precision; }
static const short precision
Definition: ert_timer.hpp:47

References precision.

◆ get_unit()

static int64_t tim::component::ert_timer::get_unit ( )
inlinestatic

Definition at line 54 of file ert_timer.hpp.

54{ return units::sec; }

Referenced by get().

◆ get_width()

static auto tim::component::ert_timer::get_width ( )
inlinestatic

Definition at line 57 of file ert_timer.hpp.

57{ return width; }
static const short width
Definition: ert_timer.hpp:48

References width.

◆ load()

auto tim::component::ert_timer::load ( ) const
inline

Definition at line 66 of file ert_timer.hpp.

66{ return value; }

Referenced by get().

◆ print()

void tim::component::ert_timer::print ( std::ostream &  os) const
inline

Definition at line 93 of file ert_timer.hpp.

93{ operation::base_printer<this_type>(os, *this); }
const std::string std::ostream * os

References tim::os.

◆ record()

static value_type tim::component::ert_timer::record ( )
inlinestaticnoexcept

Definition at line 61 of file ert_timer.hpp.

62 {
63 return tim::get_clock_real_now<int64_t, ratio_t>();
64 }

Referenced by start(), and stop().

◆ serialize()

template<typename Archive >
void tim::component::ert_timer::serialize ( Archive &  ar,
const unsigned int   
)
inline

Definition at line 80 of file ert_timer.hpp.

81 {
82 ar(cereal::make_nvp("laps", laps));
83 ar(cereal::make_nvp("value", value));
84 ar(cereal::make_nvp("accum", value));
85 }

◆ start()

void tim::component::ert_timer::start ( )
inlinenoexcept

Definition at line 72 of file ert_timer.hpp.

72{ value = record(); }
static value_type record() noexcept
Definition: ert_timer.hpp:61

References record().

◆ stop()

void tim::component::ert_timer::stop ( )
inlinenoexcept

Definition at line 73 of file ert_timer.hpp.

74 {
75 value = (record() - value);
76 ++laps;
77 }

References record().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const this_type obj 
)
friend

Definition at line 87 of file ert_timer.hpp.

88 {
89 obj.print(os);
90 return os;
91 }

Member Data Documentation

◆ format_flags

const fmtflags tim::component::ert_timer::format_flags
static
Initial value:
=
std::ios_base::fixed | std::ios_base::dec | std::ios_base::showpoint

Definition at line 49 of file ert_timer.hpp.

Referenced by get_format_flags().

◆ precision

const short tim::component::ert_timer::precision = 3
static

Definition at line 47 of file ert_timer.hpp.

Referenced by get_precision().

◆ width

const short tim::component::ert_timer::width = 8
static

Definition at line 48 of file ert_timer.hpp.

Referenced by get_width().


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