OmniSciDB  8a228a1076
logger::Duration Class Reference
+ Collaboration diagram for logger::Duration:

Public Member Functions

 Duration (DurationTree *duration_tree, int depth, Severity severity, char const *file, int line, char const *name)
 
bool stop ()
 
template<typename Units = std::chrono::milliseconds>
Units::rep relative_start_time () const
 
template<typename Units = std::chrono::milliseconds>
Units::rep value () const
 

Public Attributes

int const depth_
 
Severity const severity_
 
char const *const file_
 
int const line_
 
char const *const name_
 

Private Attributes

DurationTree *const duration_tree_
 
Clock::time_point const start_
 
Clock::time_point stop_
 

Detailed Description

Definition at line 431 of file Logger.cpp.

Constructor & Destructor Documentation

◆ Duration()

logger::Duration::Duration ( DurationTree duration_tree,
int  depth,
Severity  severity,
char const *  file,
int  line,
char const *  name 
)
inline

Definition at line 443 of file Logger.cpp.

449  : duration_tree_(duration_tree)
450  , start_(Clock::now())
451  , depth_(depth)
452  , severity_(severity)
453  , file_(file)
454  , line_(line)
455  , name_(name) {}
Clock::time_point const start_
Definition: Logger.cpp:433
char const *const name_
Definition: Logger.cpp:441
int const line_
Definition: Logger.cpp:440
int const depth_
Definition: Logger.cpp:437
DurationTree *const duration_tree_
Definition: Logger.cpp:432
char const *const file_
Definition: Logger.cpp:439
Severity const severity_
Definition: Logger.cpp:438

Member Function Documentation

◆ relative_start_time()

template<typename Units >
Units::rep logger::Duration::relative_start_time ( ) const

Definition at line 508 of file Logger.cpp.

Referenced by logger::JsonEncoder::operator()(), and logger::operator<<().

508  {
509  return std::chrono::duration_cast<Units>(start_ - duration_tree_->start_).count();
510 }
Clock::time_point const start_
Definition: Logger.cpp:433
Clock::time_point const start_
Definition: Logger.cpp:474
DurationTree *const duration_tree_
Definition: Logger.cpp:432
+ Here is the caller graph for this function:

◆ stop()

bool logger::Duration::stop ( )

Set stop_, decrement DurationTree::current_depth_. Return true iff this Duration represents the root timer (see docs).

Definition at line 501 of file Logger.cpp.

Referenced by logger::DebugTimer::stop(), and logger::DebugTimer::stopAndGetJson().

501  {
502  stop_ = Clock::now();
504  return depth_ == 0;
505 }
int const depth_
Definition: Logger.cpp:437
DurationTree *const duration_tree_
Definition: Logger.cpp:432
Clock::time_point stop_
Definition: Logger.cpp:434
+ Here is the caller graph for this function:

◆ value()

template<typename Units >
Units::rep logger::Duration::value ( ) const

Definition at line 513 of file Logger.cpp.

Referenced by logger::JsonEncoder::operator()(), and logger::operator<<().

513  {
514  return std::chrono::duration_cast<Units>(stop_ - start_).count();
515 }
Clock::time_point const start_
Definition: Logger.cpp:433
Clock::time_point stop_
Definition: Logger.cpp:434
+ Here is the caller graph for this function:

Member Data Documentation

◆ depth_

int const logger::Duration::depth_

◆ duration_tree_

DurationTree* const logger::Duration::duration_tree_
private

Definition at line 432 of file Logger.cpp.

◆ file_

char const* const logger::Duration::file_

Definition at line 439 of file Logger.cpp.

Referenced by logger::JsonEncoder::operator()(), and logger::operator<<().

◆ line_

int const logger::Duration::line_

Definition at line 440 of file Logger.cpp.

Referenced by logger::JsonEncoder::operator()(), and logger::operator<<().

◆ name_

char const* const logger::Duration::name_

Definition at line 441 of file Logger.cpp.

Referenced by logger::JsonEncoder::operator()(), and logger::operator<<().

◆ severity_

Severity const logger::Duration::severity_

Definition at line 438 of file Logger.cpp.

◆ start_

Clock::time_point const logger::Duration::start_
private

Definition at line 433 of file Logger.cpp.

◆ stop_

Clock::time_point logger::Duration::stop_
private

Definition at line 434 of file Logger.cpp.


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