libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
foedus::debugging::StopWatch Class Reference

A high-resolution stop watch. More...

Detailed Description

A high-resolution stop watch.

Stop-watch has some overhead, so use instantiate this too frequently (per sec-ms: fine. per us: mmm. per ns: oh god).

Definition at line 30 of file stop_watch.hpp.

#include <stop_watch.hpp>

Public Member Functions

 StopWatch ()
 
void start ()
 Take current time tick. More...
 
uint64_t stop ()
 Take another current time tick. More...
 
uint64_t peek_elapsed_ns () const
 
uint64_t elapsed_ns () const
 
double elapsed_us () const
 
double elapsed_ms () const
 
double elapsed_sec () const
 

Constructor & Destructor Documentation

foedus::debugging::StopWatch::StopWatch ( )
inline

Definition at line 32 of file stop_watch.hpp.

References start().

32 : started_(0), stopped_(0) { start(); }
void start()
Take current time tick.
Definition: stop_watch.cpp:30

Here is the call graph for this function:

Member Function Documentation

uint64_t foedus::debugging::StopWatch::elapsed_ns ( ) const
inline

Definition at line 42 of file stop_watch.hpp.

Referenced by foedus::memory::AlignedMemory::alloc(), foedus::xct::XctManagerPimpl::handle_epoch_chime_wait_grace_period(), and stop().

42  {
43  return stopped_ - started_;
44  }

Here is the caller graph for this function:

double foedus::debugging::StopWatch::elapsed_sec ( ) const
inline

Definition at line 51 of file stop_watch.hpp.

Referenced by foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages_parallel(), foedus::snapshot::LogGleaner::execute(), and foedus::snapshot::LogMapper::handle_process().

51  {
52  return static_cast<double>(stopped_ - started_) / 1000000000.0;
53  }

Here is the caller graph for this function:

uint64_t foedus::debugging::StopWatch::peek_elapsed_ns ( ) const

Definition at line 39 of file stop_watch.cpp.

References foedus::debugging::get_now_nanosec().

39  {
40  return get_now_nanosec() - started_;
41 }
uint64_t get_now_nanosec()
Definition: stop_watch.cpp:25

Here is the call graph for this function:

void foedus::debugging::StopWatch::start ( )

Take current time tick.

Definition at line 30 of file stop_watch.cpp.

References foedus::debugging::get_now_nanosec().

Referenced by foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root(), foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root_double(), foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata(), and StopWatch().

30  {
31  started_ = get_now_nanosec();
32  stopped_ = started_;
33 }
uint64_t get_now_nanosec()
Definition: stop_watch.cpp:25

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t foedus::debugging::StopWatch::stop ( )

Take another current time tick.

Returns elapsed nanosec.

Definition at line 35 of file stop_watch.cpp.

References elapsed_ns(), and foedus::debugging::get_now_nanosec().

Referenced by foedus::memory::AlignedMemory::alloc(), foedus::storage::StorageManagerPimpl::clone_all_storage_metadata(), foedus::storage::array::ArrayComposer::compose(), foedus::storage::hash::HashComposer::compose(), foedus::storage::masstree::MasstreeComposer::compose(), foedus::storage::sequential::SequentialComposer::compose(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::sequential::SequentialComposer::construct_root(), foedus::storage::masstree::design_partition_first_parallel(), foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages(), foedus::snapshot::SnapshotManagerPimpl::drop_volatile_pages_parallel(), foedus::cache::CacheHashtable::evict_main_loop(), foedus::cache::CacheHashtable::evict_overflow_loop(), foedus::snapshot::LogGleaner::execute(), foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root(), foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root_double(), foedus::cache::CacheManagerPimpl::handle_cleaner(), foedus::xct::XctManagerPimpl::handle_epoch_chime_wait_grace_period(), foedus::snapshot::LogMapper::handle_process(), foedus::memory::PagePoolPimpl::initialize_once(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), foedus::storage::array::ArrayStoragePimpl::prefetch_pages(), foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_normalized(), foedus::snapshot::SnapshotManagerPimpl::read_snapshot_metadata(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata(), foedus::storage::hash::HashPartitioner::sort_batch(), foedus::storage::array::ArrayPartitioner::sort_batch(), and foedus::memory::PagePoolPimpl::uninitialize_once().

35  {
36  stopped_ = get_now_nanosec();
37  return elapsed_ns();
38 }
uint64_t elapsed_ns() const
Definition: stop_watch.hpp:42
uint64_t get_now_nanosec()
Definition: stop_watch.cpp:25

Here is the call graph for this function:

Here is the caller graph for this function:


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