From 519d2b1fae0657c57acfeec51cf0d56938addf18 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 14 May 2018 15:17:43 -0700 Subject: Cleanup stats removal for opt build. Stats will only be collected on debug builds or if GRPC_COLLECT_STATS is defined. --- tools/codegen/core/gen_stats_data.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools/codegen') 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, -- cgit v1.2.3