proxygen
|
#include <TimeUtil.h>
Public Member Functions | |
TimePoint (bool set=true) | |
void | reset () |
bool | isUnset () const |
std::chrono::steady_clock::time_point | getTime () const |
std::chrono::steady_clock::time_point | getTimeStart () const |
std::chrono::steady_clock::time_point | getTimeEnd () const |
std::chrono::nanoseconds | getTimeWaiting () const |
pid_t | getTid () const |
Private Attributes | |
std::chrono::steady_clock::time_point | timeStart_ |
std::chrono::steady_clock::time_point | timeEnd_ |
std::chrono::nanoseconds | timeWaiting_ {0} |
pid_t | tid_ |
A class for tracking time durations in test code.
This is primarily useful for testing timeout functionality. When comparing the differences between two TimePoints, it can exclude time spent waiting on the OS scheduler. This helps avoid spurious test failures when timeouts are exceeded by longer than expected simply because the underlying system was busy and could not schedule this thread in time.
Definition at line 34 of file TimeUtil.h.
|
inlineexplicit |
|
inline |
Definition at line 66 of file TimeUtil.h.
References tid_.
Referenced by folly::checkTimeout(), and std::chrono::PrintTo().
|
inline |
Definition at line 50 of file TimeUtil.h.
References timeStart_.
Referenced by TEST(), and TEST_F().
|
inline |
Definition at line 58 of file TimeUtil.h.
References timeStart_.
Referenced by folly::checkTimeout(), folly::operator<<(), and TEST_F().
|
inline |
Definition at line 54 of file TimeUtil.h.
References timeStart_.
Referenced by folly::checkTimeout(), folly::operator<<(), std::chrono::PrintTo(), and TEST_F().
|
inline |
Definition at line 62 of file TimeUtil.h.
References timeWaiting_.
Referenced by folly::checkTimeout(), folly::operator<<(), std::chrono::PrintTo(), and TEST_F().
|
inline |
Definition at line 44 of file TimeUtil.h.
References timeEnd_, timeStart_, and timeWaiting_.
Referenced by TEST().
void folly::TimePoint::reset | ( | ) |
Definition at line 221 of file TimeUtil.cpp.
References folly::getOSThreadID(), folly::getSchedTimeWaiting(), now(), and tid_.
Referenced by TEST(), TEST_F(), and TimePoint().
|
private |
Definition at line 74 of file TimeUtil.h.
Referenced by getTid().
|
private |
Definition at line 72 of file TimeUtil.h.
Referenced by isUnset().
|
private |
Definition at line 71 of file TimeUtil.h.
Referenced by getTime(), getTimeEnd(), getTimeStart(), and isUnset().
|
private |
Definition at line 73 of file TimeUtil.h.
Referenced by getTimeWaiting(), and isUnset().