diff options
author | yang-g <yangg@google.com> | 2017-08-21 13:41:08 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2017-08-21 13:41:08 -0700 |
commit | 4fa6caa066e208b24c97a1599bae4080f321508a (patch) | |
tree | a8ef9fecbc7f851e09a6343689dd625cd1e6863a | |
parent | d6cf6dea3677c753e27999d0f2f9695da78932f2 (diff) |
Add a new macro for custom profiler
-rw-r--r-- | src/core/lib/profiling/timers.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/lib/profiling/timers.h b/src/core/lib/profiling/timers.h index 58e6659e6d..fcc9a0d6fd 100644 --- a/src/core/lib/profiling/timers.h +++ b/src/core/lib/profiling/timers.h @@ -37,7 +37,8 @@ void gpr_timers_set_log_filename(const char *filename); void gpr_timer_set_enabled(int enabled); -#if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER)) +#if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER) + \ + defined(GRPC_CUSTOM_PROFILER)) /* No profiling. No-op all the things. */ #define GPR_TIMER_MARK(tag, important) \ do { \ @@ -56,6 +57,12 @@ void gpr_timer_set_enabled(int enabled); #if defined(GRPC_STAP_PROFILER) && defined(GRPC_BASIC_PROFILER) #error "GRPC_STAP_PROFILER and GRPC_BASIC_PROFILER are mutually exclusive." #endif +#if defined(GRPC_STAP_PROFILER) && defined(GRPC_CUSTOM_PROFILER) +#error "GRPC_STAP_PROFILER and GRPC_CUSTOM_PROFILER are mutually exclusive." +#endif +#if defined(GRPC_CUSTOM_PROFILER) && defined(GRPC_BASIC_PROFILER) +#error "GRPC_CUSTOM_PROFILER and GRPC_BASIC_PROFILER are mutually exclusive." +#endif /* Generic profiling interface. */ #define GPR_TIMER_MARK(tag, important) \ @@ -80,7 +87,8 @@ void gpr_timer_set_enabled(int enabled); #ifdef __cplusplus } -#if (defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER)) +#if (defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER) + \ + defined(GRPC_CUSTOM_PROFILER)) namespace grpc { class ProfileScope { public: @@ -92,7 +100,7 @@ class ProfileScope { private: const char *const desc_; }; -} +} // namespace grpc #define GPR_TIMER_SCOPE(tag, important) \ ::grpc::ProfileScope _profile_scope_##__LINE__((tag), (important)) |