20 #include "absl/strings/str_cat.h" 25 #if defined(__GNUC__) || defined(__GNUG__) 26 #define AFUNC __PRETTY_FUNCTION__ 27 #elif defined(__clang__) 28 #define AFUNC __PRETTY_FUNCTION__ 30 #define AFUNC __func__ 68 const std::string& indicator =
"");
81 int64_t
End(
const std::string& msg);
87 DISALLOW_COPY_AND_ASSIGN(
Timer);
92 explicit TimerWrapper(
const std::string& msg) : msg_(msg) { timer_.Start(); }
107 #if defined(ENABLE_PERF) 108 #define PERF_FUNCTION() \ 109 apollo::common::util::TimerWrapper _timer_wrapper_( \ 110 apollo::common::util::function_signature(AFUNC)) 111 #define PERF_FUNCTION_WITH_NAME(func_name) \ 112 apollo::common::util::TimerWrapper _timer_wrapper_(func_name) 113 #define PERF_FUNCTION_WITH_INDICATOR(indicator) \ 114 apollo::common::util::TimerWrapper _timer_wrapper_( \ 115 apollo::common::util::function_signature(AFUNC, indicator)) 116 #define PERF_BLOCK_START() \ 117 apollo::common::util::Timer _timer_; \ 119 #define PERF_BLOCK_END(msg) _timer_.End(msg) 120 #define PERF_BLOCK_END_WITH_INDICATOR(indicator, msg) \ 121 _timer_.End(absl::StrCat(indicator, "_", msg)) 123 #define PERF_FUNCTION() 124 #define PERF_FUNCTION_WITH_NAME(func_name) UNUSED(func_name); 125 #define PERF_FUNCTION_WITH_INDICATOR(indicator) UNUSED(indicator); 126 #define PERF_BLOCK_START() 127 #define PERF_BLOCK_END(msg) UNUSED(msg); 128 #define PERF_BLOCK_END_WITH_INDICATOR(indicator, msg) \ 133 #endif // ENABLE_PERF TimerWrapper(const std::string &msg)
Definition: perf_util.h:92
Definition: perf_util.h:70
~TimerWrapper()
Definition: perf_util.h:94
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
#define DISALLOW_COPY_AND_ASSIGN(classname)
Definition: macros.h:48
std::string function_signature(const std::string &func_name, const std::string &indicator="")
int64_t End(const std::string &msg)
Definition: perf_util.h:90
Cyber has builtin time type Time.
Definition: time.h:31