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

Merge pull request #974 from emailweixu/timer_namespace

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