aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/codegen
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-05-14 15:17:43 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-05-14 15:17:43 -0700
commit519d2b1fae0657c57acfeec51cf0d56938addf18 (patch)
treed22c1361a2825b390b16c3f859cfeade13a6539a /tools/codegen
parentae3866bf6b58bd4a0f4c5d1f2e88e3dcea799213 (diff)
Cleanup stats removal for opt build. Stats will only be collected on debug builds or if GRPC_COLLECT_STATS is defined.
Diffstat (limited to 'tools/codegen')
-rwxr-xr-xtools/codegen/core/gen_stats_data.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/codegen/core/gen_stats_data.py b/tools/codegen/core/gen_stats_data.py
index 1f443ac1d0..9b10c67afa 100755
--- a/tools/codegen/core/gen_stats_data.py
+++ b/tools/codegen/core/gen_stats_data.py
@@ -265,13 +265,24 @@ with open('src/core/lib/debug/stats_data.h', 'w') as H:
print >> H, " GRPC_STATS_HISTOGRAM_BUCKETS = %d" % first_slot
print >> H, "} grpc_stats_histogram_constants;"
+ print >> H, "#if defined(GRPC_COLLECT_STATS) || !defined(NDEBUG)"
+ for ctr in inst_map['Counter']:
+ print >> H, ("#define GRPC_STATS_INC_%s() " +
+ "GRPC_STATS_INC_COUNTER(GRPC_STATS_COUNTER_%s)") % (
+ ctr.name.upper(), ctr.name.upper())
+ for histogram in inst_map['Histogram']:
+ print >> H, "#define GRPC_STATS_INC_%s(value) grpc_stats_inc_%s( (int)(value))" % (
+ histogram.name.upper(), histogram.name.lower())
+ print >> H, "void grpc_stats_inc_%s(int x);" % histogram.name.lower()
+
+ print >> H, "#else"
for ctr in inst_map['Counter']:
print >> H, ("#define GRPC_STATS_INC_%s() ") % (
ctr.name.upper())
for histogram in inst_map['Histogram']:
print >> H, "#define GRPC_STATS_INC_%s(value)" % (
histogram.name.upper())
- print >> H, "void grpc_stats_inc_%s(int x);" % histogram.name.lower()
+ print >> H, "#endif /* defined(GRPC_COLLECT_STATS) || !defined(NDEBUG) */"
for i, tbl in enumerate(static_tables):
print >> H, "extern const %s grpc_stats_table_%d[%d];" % (tbl[0], i,