libfoedus-core
FOEDUS Core Library
foedus::debugging::RdtscWatch Class Reference

A RDTSC-based low-overhead stop watch. More...

Detailed Description

A RDTSC-based low-overhead stop watch.

Unlike foedus::debugging::StopWatch, this watch is extremely low-overhead thus can be used in performance sensitive places. Instead, it can only show cycles elapsed. You have to do the math to convert it to sec/ms/us/ns yourself. This doesn't take care of wrap around (VERY rare), either.

Definition at line 37 of file rdtsc_watch.hpp.

#include <rdtsc_watch.hpp>

Public Member Functions

 RdtscWatch () __attribute__((always_inline))
 
void start () __attribute__((always_inline))
 Take current time tick. More...
 
uint64_t stop () __attribute__((always_inline))
 Take another current time tick. More...
 
uint64_t elapsed () const __attribute__((always_inline))
 

Constructor & Destructor Documentation

foedus::debugging::RdtscWatch::RdtscWatch ( )
inline

Definition at line 39 of file rdtsc_watch.hpp.

References start().

39 : started_(0), stopped_(0) { start(); }
void start() __attribute__((always_inline))
Take current time tick.
Definition: rdtsc_watch.hpp:42

Here is the call graph for this function:

Member Function Documentation

uint64_t foedus::debugging::RdtscWatch::elapsed ( ) const
inline
void foedus::debugging::RdtscWatch::start ( )
inline

Take current time tick.

Definition at line 42 of file rdtsc_watch.hpp.

References foedus::debugging::get_rdtsc().

Referenced by RdtscWatch().

42  {
43  started_ = get_rdtsc();
44  }
uint64_t get_rdtsc()
Returns the current CPU cycle via x86 RDTSC.
Definition: rdtsc.hpp:35

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t foedus::debugging::RdtscWatch::stop ( )
inline

Take another current time tick.

Returns elapsed nanosec.

Definition at line 47 of file rdtsc_watch.hpp.

References elapsed(), and foedus::debugging::get_rdtsc().

Referenced by foedus::snapshot::LogReducerRef::append_log_chunk(), foedus::storage::masstree::SplitBorder::lock_existing_records(), foedus::storage::masstree::MasstreePartitioner::partition_batch(), and foedus::assorted::spin_until().

47  {
48  stopped_ = get_rdtsc();
49  return elapsed();
50  }
uint64_t elapsed() const __attribute__((always_inline))
Definition: rdtsc_watch.hpp:52
uint64_t get_rdtsc()
Returns the current CPU cycle via x86 RDTSC.
Definition: rdtsc.hpp:35

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 file: