#include <grpc/support/port_platform.h>
-#include <grpc/support/atm.h>
#include <stdbool.h>
+#include <grpc/support/atm.h>
+
+#include "src/core/lib/gprpp/global_config.h"
+
+GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_trace);
+
+// TODO(veblush): Remove this deprecated function once codes depending on this
+// function are updated in the internal repo.
void grpc_tracer_init(const char* env_var_name);
+
+void grpc_tracer_init();
void grpc_tracer_shutdown(void);
#if defined(__has_feature)
// wrapped language (wr don't want to force recompilation to get tracing).
// Internally, however, for performance reasons, we compile them out by
// default, since internal build systems make recompiling trivial.
+//
+// Prefer GRPC_TRACE_FLAG_ENABLED() macro instead of using enabled() directly.
#define GRPC_USE_TRACERS // tracers on by default in OSS
#if defined(GRPC_USE_TRACERS) || !defined(NDEBUG)
bool enabled() {
#endif
};
+#define GRPC_TRACE_FLAG_ENABLED(f) GPR_UNLIKELY((f).enabled())
+
#ifndef NDEBUG
typedef TraceFlag DebugOnlyTraceFlag;
#else
class DebugOnlyTraceFlag {
public:
- constexpr DebugOnlyTraceFlag(bool default_enabled, const char* name) {}
+ constexpr DebugOnlyTraceFlag(bool /*default_enabled*/, const char* /*name*/) {
+ }
constexpr bool enabled() const { return false; }
constexpr const char* name() const { return "DebugOnlyTraceFlag"; }
private:
- void set_enabled(bool enabled) {}
+ void set_enabled(bool /*enabled*/) {}
};
#endif