diff options
author | ncteisen <ncteisen@gmail.com> | 2017-11-10 16:57:53 -0800 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-11-10 16:57:53 -0800 |
commit | 05294b682b8d6a3970138fc87b0bc356b31ded97 (patch) | |
tree | 15b992bd81b016b7e3c6105af8734cfcfbdace51 /src/core/lib | |
parent | 05fbb9d13de546560b1fb799cb4b1ff622c47713 (diff) |
Make debug flags DebugOnly
Diffstat (limited to 'src/core/lib')
21 files changed, 25 insertions, 67 deletions
diff --git a/src/core/lib/debug/trace.cc b/src/core/lib/debug/trace.cc index 8fb6393a36..5d37713546 100644 --- a/src/core/lib/debug/trace.cc +++ b/src/core/lib/debug/trace.cc @@ -36,7 +36,7 @@ TraceFlag::TraceFlag(bool default_enabled, const char *name) root_tracer_ = this; } -void TraceFlag::List() { +void TraceFlag::LogAllTracers() { gpr_log(GPR_DEBUG, "available tracers:"); TraceFlag *t; for (t = root_tracer_; t != nullptr; t = t->next_tracer_) { @@ -51,7 +51,7 @@ bool TraceFlag::Set(const char *name, bool enabled) { t->set_enabled(enabled); } } else if (0 == strcmp(name, "list_tracers")) { - List(); + LogAllTracers(); } else if (0 == strcmp(name, "refcount")) { for (t = root_tracer_; t; t = t->next_tracer_) { if (strstr(t->name_, "refcount") != NULL) { diff --git a/src/core/lib/debug/trace.h b/src/core/lib/debug/trace.h index 274849d157..162090a248 100644 --- a/src/core/lib/debug/trace.h +++ b/src/core/lib/debug/trace.h @@ -72,7 +72,7 @@ class TraceFlag { } private: - static void List(); + static void LogAllTracers(); static TraceFlag *root_tracer_; TraceFlag *next_tracer_; diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 527075e566..5171ac1529 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -33,9 +33,7 @@ extern "C" { struct grpc_closure; typedef struct grpc_closure grpc_closure; -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_closure; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_closure; typedef struct grpc_closure_list { grpc_closure* head; diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 271938bf28..c81429ef8a 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -38,9 +38,7 @@ extern "C" { typedef struct grpc_error grpc_error; -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_error_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_error_refcount; typedef enum { /// 'errno' from the operating system diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index aa9d0735ac..9abd569ee0 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -59,9 +59,7 @@ #define MAX_EPOLL_EVENTS 100 #define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 5 -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_pollable_refcount(false, "pollable_refcount"); -#endif +grpc_core::DebugOnlyTraceFlag grpc_trace_pollable_refcount(false, "pollable_refcount"); /******************************************************************************* * pollable Declarations diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index b666917464..5b4b66b989 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -37,10 +37,7 @@ #include "src/core/lib/support/env.h" grpc_core::TraceFlag grpc_polling_trace(false, "polling"); /* Disabled by default */ - -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_fd_refcount(false, "fd_refcount"); -#endif +grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount(false, "fd_refcount"); /** Default poll() function - a pointer so that it can be overridden by some * tests */ diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index c48ff982c6..6911a8ee12 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -29,9 +29,7 @@ extern "C" { #endif -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_fd_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount; /* A grpc_pollset is a set of file descriptors that a higher level item is interested in. For example: diff --git a/src/core/lib/security/context/security_context.cc b/src/core/lib/security/context/security_context.cc index f12b312299..31e7510d35 100644 --- a/src/core/lib/security/context/security_context.cc +++ b/src/core/lib/security/context/security_context.cc @@ -29,10 +29,8 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_auth_context_refcount(false, +grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount(false, "auth_context_refcount"); -#endif /* --- grpc_call --- */ diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 57344df96b..5b27d1a42e 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -22,9 +22,7 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/security/credentials/credentials.h" -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_auth_context_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount; #ifdef __cplusplus extern "C" { diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc index 23e92c0b8f..308fdce05b 100644 --- a/src/core/lib/security/transport/security_connector.cc +++ b/src/core/lib/security/transport/security_connector.cc @@ -44,10 +44,8 @@ #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security_adapter.h" -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_security_connector_refcount( +grpc_core::DebugOnlyTraceFlag grpc_trace_security_connector_refcount( false, "security_connector_refcount"); -#endif /* -- Constants. -- */ diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h index 10a4ef1a6d..7cde358b41 100644 --- a/src/core/lib/security/transport/security_connector.h +++ b/src/core/lib/security/transport/security_connector.h @@ -33,9 +33,7 @@ extern "C" { #endif -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_security_connector_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_security_connector_refcount; /* --- status enum. --- */ diff --git a/src/core/lib/surface/alarm.cc b/src/core/lib/surface/alarm.cc index af1a48247c..8ba4a93525 100644 --- a/src/core/lib/surface/alarm.cc +++ b/src/core/lib/surface/alarm.cc @@ -27,9 +27,7 @@ #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/surface/completion_queue.h" -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_alarm_refcount(false, "alarm_refcount"); -#endif +grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount(false, "alarm_refcount"); struct grpc_alarm { gpr_refcount refs; diff --git a/src/core/lib/surface/alarm_internal.h b/src/core/lib/surface/alarm_internal.h index fa86815ed0..47fd1acaf0 100644 --- a/src/core/lib/surface/alarm_internal.h +++ b/src/core/lib/surface/alarm_internal.h @@ -26,9 +26,9 @@ extern "C" { #endif -#ifndef NDEBUG +extern grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount; -extern grpc_core::TraceFlag grpc_trace_alarm_refcount; +#ifndef NDEBUG #define GRPC_ALARM_REF(a, reason) alarm_ref_dbg(a, reason, __FILE__, __LINE__) #define GRPC_ALARM_UNREF(a, reason) \ diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 72b62d4220..b5ae87ee66 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -41,10 +41,8 @@ #include "src/core/lib/surface/event_string.h" grpc_core::TraceFlag grpc_trace_operation_failures(false, "op_failure"); -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_pending_tags(false, "pending_tags"); -grpc_core::TraceFlag grpc_trace_cq_refcount(false, "cq_refcount"); -#endif +grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags(false, "pending_tags"); +grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount(false, "cq_refcount"); // Specifies a cq thread local cache. // The first event that occurs on a thread diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 945b6734b1..9fdb48dd23 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -30,11 +30,8 @@ extern grpc_core::TraceFlag grpc_cq_pluck_trace; extern grpc_core::TraceFlag grpc_cq_event_timeout_trace; extern grpc_core::TraceFlag grpc_trace_operation_failures; - -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_pending_tags; -extern grpc_core::TraceFlag grpc_trace_cq_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags; +extern grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount; #ifdef __cplusplus extern "C" { diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index c8a28e3be6..e4aa9231fe 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -126,10 +126,6 @@ void grpc_init(void) { grpc_slice_intern_init(); grpc_mdctx_global_init(); grpc_channel_init_init(); - -#ifndef NDEBUG - -#endif grpc_security_pre_init(); grpc_iomgr_init(&exec_ctx); gpr_timers_global_init(); diff --git a/src/core/lib/surface/init_secure.cc b/src/core/lib/surface/init_secure.cc index fcca71c822..4df622521b 100644 --- a/src/core/lib/surface/init_secure.cc +++ b/src/core/lib/surface/init_secure.cc @@ -32,16 +32,9 @@ #include "src/core/lib/security/transport/security_handshaker.h" #include "src/core/lib/surface/channel_init.h" #include "src/core/tsi/transport_security_interface.h" - -#ifndef NDEBUG #include "src/core/lib/security/context/security_context.h" -#endif - -void grpc_security_pre_init(void) { -#ifndef NDEBUG -#endif -} +void grpc_security_pre_init(void) {} static bool maybe_prepend_client_auth_filter( grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) { diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 8022688bff..d58381852a 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -48,8 +48,9 @@ * used to determine which kind of element a pointer refers to. */ +grpc_core::DebugOnlyTraceFlag grpc_trace_metadata(false, "metadata"); + #ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_metadata(false, "metadata"); #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line #define REF_MD_LOCKED(shard, s) ref_md_locked((shard), (s), __FILE__, __LINE__) diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 2f112523af..931ba0b44f 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -25,9 +25,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_metadata; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata; #ifdef __cplusplus extern "C" { diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index 95f2b65846..2aa89426df 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -31,9 +31,7 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport_impl.h" -#ifndef NDEBUG -grpc_core::TraceFlag grpc_trace_stream_refcount(false, "stream_refcount"); -#endif +grpc_core::DebugOnlyTraceFlag grpc_trace_stream_refcount(false, "stream_refcount"); #ifndef NDEBUG void grpc_stream_ref(grpc_stream_refcount* refcount, const char* reason) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 6750f8cca3..2347005c62 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -43,9 +43,7 @@ typedef struct grpc_transport grpc_transport; for a stream. */ typedef struct grpc_stream grpc_stream; -#ifndef NDEBUG -extern grpc_core::TraceFlag grpc_trace_stream_refcount; -#endif +extern grpc_core::DebugOnlyTraceFlag grpc_trace_stream_refcount; typedef struct grpc_stream_refcount { gpr_refcount refs; |