提交 c1b294a3 编写于 作者: B backyes 提交者: GitHub

Merge pull request #974 from emailweixu/timer_namespace

Adding namespace in timing macros
...@@ -137,6 +137,9 @@ void StatSet::printSegTimerStatus() { ...@@ -137,6 +137,9 @@ void StatSet::printSegTimerStatus() {
void StatSet::printBarrierTimerStatus() { void StatSet::printBarrierTimerStatus() {
ReadLockGuard guard(lock_); ReadLockGuard guard(lock_);
if (barrierStatSet_.empty()) {
return;
}
// control barrierAbstact in runtime, so enable compliation // control barrierAbstact in runtime, so enable compliation
LOG(INFO) << std::setiosflags(std::ios::left) << std::setfill(' ') LOG(INFO) << std::setiosflags(std::ios::left) << std::setfill(' ')
<< "======= BarrierStatSet status ======" << std::endl; << "======= BarrierStatSet status ======" << std::endl;
......
...@@ -258,28 +258,41 @@ inline StatSet& registerTimerArg2(uint64_t threshold = -1, ...@@ -258,28 +258,41 @@ inline StatSet& registerTimerArg2(uint64_t threshold = -1,
// The default arguments are shown in the following line: // The default arguments are shown in the following line:
// REGISTER_TIMER(statName, threshold = -1, statSet = globalStat) // REGISTER_TIMER(statName, threshold = -1, statSet = globalStat)
// TODO(yuyang18,wangyanfei01): if UNIQUE_NAME is needed // TODO(yuyang18,wangyanfei01): if UNIQUE_NAME is needed
#define REGISTER_TIMER(statName, ...) \ #define REGISTER_TIMER(statName, ...) \
static StatPtr __stat = registerTimerArg2(__VA_ARGS__).getStat(statName); \ static ::paddle::StatPtr __stat = \
TimerOnce __timerOnce(__stat.get(), "", registerTimerArg1(__VA_ARGS__)); ::paddle::registerTimerArg2(__VA_ARGS__).getStat(statName); \
::paddle::TimerOnce __timerOnce( \
__stat.get(), "", ::paddle::registerTimerArg1(__VA_ARGS__));
#define REGISTER_TIMER_SET(statName, start, ...) \ #define REGISTER_TIMER_SET(statName, start, ...) \
static StatPtr __stat = registerTimerArg2(__VA_ARGS__).getStat(statName); \ static ::paddle::StatPtr __stat = \
TimerOnce __timerOnce( \ ::paddle::registerTimerArg2(__VA_ARGS__).getStat(statName); \
__stat.get(), "", registerTimerArg1(__VA_ARGS__), false, start); ::paddle::TimerOnce __timerOnce(__stat.get(), \
"", \
::paddle::registerTimerArg1(__VA_ARGS__), \
false, \
start);
// dynmaic timer, support to discriminate runtime entity, used in pserver // dynmaic timer, support to discriminate runtime entity, used in pserver
#define REGISTER_TIMER_DYNAMIC(statName, ...) \ #define REGISTER_TIMER_DYNAMIC(statName, ...) \
StatPtr __stat = registerTimerArg2(__VA_ARGS__).getStat(statName); \ ::paddle::StatPtr __stat = \
TimerOnce __timerOnce(__stat.get(), "", registerTimerArg1(__VA_ARGS__)); ::paddle::registerTimerArg2(__VA_ARGS__).getStat(statName); \
::paddle::TimerOnce __timerOnce( \
#define REGISTER_TIMER_DYNAMIC_SET(statName, start, ...) \ __stat.get(), "", ::paddle::registerTimerArg1(__VA_ARGS__));
StatPtr __stat = registerTimerArg2(__VA_ARGS__).getStat(statName); \
TimerOnce __timerOnce( \ #define REGISTER_TIMER_DYNAMIC_SET(statName, start, ...) \
__stat.get(), "", registerTimerArg1(__VA_ARGS__), false, start); ::paddle::StatPtr __stat = \
::paddle::registerTimerArg2(__VA_ARGS__).getStat(statName); \
#define REGISTER_TIMER_INFO(statName, info) \ ::paddle::TimerOnce __timerOnce(__stat.get(), \
static StatPtr __stat = globalStat.getStat(statName); \ "", \
TimerOnce __timerOnce(__stat.get(), info, 10 * 1000000LU /*threshold*/); ::paddle::registerTimerArg1(__VA_ARGS__), \
false, \
start);
#define REGISTER_TIMER_INFO(statName, info) \
static ::paddle::StatPtr __stat = ::paddle::globalStat.getStat(statName); \
::paddle::TimerOnce __timerOnce( \
__stat.get(), info, 10 * 1000000LU /*threshold*/);
#endif // DISABLE_TIMER #endif // DISABLE_TIMER
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册