OmniSciDB  16c4e035a1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 92 of file QueryState.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file QueryState.cpp.

44  : name(name)
45  , parent(parent)
46  , thread_id(std::this_thread::get_id())
47  , started(Clock::now().time_since_epoch())
48  , stopped(Clock::duration::zero()) {}
Clock::duration const started
Definition: QueryState.h:96
Events::iterator const parent
Definition: QueryState.h:94
std::atomic< Clock::duration > stopped
Definition: QueryState.h:98
std::thread::id const thread_id
Definition: QueryState.h:95
char const *const name
Definition: QueryState.h:93

Member Function Documentation

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

Definition at line 101 of file QueryState.h.

References count, started, and stopped.

101  {
102  auto const stop_time = stopped.load();
103  return boost::make_optional(
104  stop_time != Clock::duration::zero(),
105  std::chrono::duration_cast<Units>(stop_time - started).count());
106  }
Clock::duration const started
Definition: QueryState.h:96
std::atomic< Clock::duration > stopped
Definition: QueryState.h:98
int count
void query_state::Event::stop ( )

Definition at line 50 of file QueryState.cpp.

References CHECK, and stopped.

50  {
51  CHECK(stopped.exchange(Clock::now().time_since_epoch()) == Clock::duration::zero())
52  << "stop() called more than once.";
53 }
std::atomic< Clock::duration > stopped
Definition: QueryState.h:98
#define CHECK(condition)
Definition: Logger.h:211

Member Data Documentation

char const* const query_state::Event::name

Definition at line 93 of file QueryState.h.

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

Definition at line 94 of file QueryState.h.

Referenced by generate_TableFunctionsFactory_init.Node::get_parent().

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

Definition at line 96 of file QueryState.h.

Referenced by duration().

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

Definition at line 98 of file QueryState.h.

Referenced by duration(), and stop().

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

Definition at line 95 of file QueryState.h.


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