OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
query_state::Event Struct Reference

#include <QueryState.h>

Public Member Functions

 Event (char const *const name, Events::iterator parent)
 
template<typename Units = std::chrono::milliseconds>
boost::optional< typename
Units::rep > 
duration () const
 
void stop ()
 

Public Attributes

char const *const name
 
Events::iterator const parent
 
std::thread::id const thread_id
 
Clock::duration const started
 
std::atomic< Clock::duration > stopped
 

Detailed Description

Definition at line 88 of file QueryState.h.

Constructor & Destructor Documentation

query_state::Event::Event ( char const *const  name,
Events::iterator  parent 
)

Definition at line 32 of file QueryState.cpp.

33  : name(name)
34  , parent(parent)
35  , thread_id(std::this_thread::get_id())
36  , started(Clock::now().time_since_epoch())
37  , stopped(Clock::duration::zero()) {}
Clock::duration const started
Definition: QueryState.h:92
Events::iterator const parent
Definition: QueryState.h:90
std::atomic< Clock::duration > stopped
Definition: QueryState.h:94
std::thread::id const thread_id
Definition: QueryState.h:91
char const *const name
Definition: QueryState.h:89

Member Function Documentation

template<typename Units = std::chrono::milliseconds>
boost::optional<typename Units::rep> query_state::Event::duration ( ) const
inline

Definition at line 97 of file QueryState.h.

References started, and stopped.

97  {
98  auto const stop_time = stopped.load();
99  return boost::make_optional(
100  stop_time != Clock::duration::zero(),
101  std::chrono::duration_cast<Units>(stop_time - started).count());
102  }
Clock::duration const started
Definition: QueryState.h:92
std::atomic< Clock::duration > stopped
Definition: QueryState.h:94
void query_state::Event::stop ( )

Definition at line 39 of file QueryState.cpp.

References CHECK(), and stopped.

39  {
40  CHECK(stopped.exchange(Clock::now().time_since_epoch()) == Clock::duration::zero())
41  << "stop() called more than once.";
42 }
std::atomic< Clock::duration > stopped
Definition: QueryState.h:94
CHECK(cgen_state)

+ Here is the call graph for this function:

Member Data Documentation

char const* const query_state::Event::name

Definition at line 89 of file QueryState.h.

Events::iterator const query_state::Event::parent

Definition at line 90 of file QueryState.h.

Clock::duration const query_state::Event::started

Definition at line 92 of file QueryState.h.

Referenced by duration().

std::atomic<Clock::duration> query_state::Event::stopped

Definition at line 94 of file QueryState.h.

Referenced by duration(), and stop().

std::thread::id const query_state::Event::thread_id

Definition at line 91 of file QueryState.h.


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