Bounds fixes

pull/12334/head
Craig Tiller 7 years ago
parent 07530dbbeb
commit 3e3dd08087
  1. 12
      src/core/lib/debug/stats_data.c
  2. 2
      test/core/debug/stats_test.cc
  3. 2
      tools/codegen/core/gen_stats_data.py

@ -105,7 +105,7 @@ void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) {
} }
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_0, 65)); (exec_ctx), value, grpc_stats_table_0, 64));
} }
void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) { void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) {
value = GPR_CLAMP(value, 0, 1024); value = GPR_CLAMP(value, 0, 1024);
@ -130,7 +130,7 @@ void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) {
} }
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_2, 65)); (exec_ctx), value, grpc_stats_table_2, 64));
} }
void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) { void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) {
value = GPR_CLAMP(value, 0, 16777216); value = GPR_CLAMP(value, 0, 16777216);
@ -155,7 +155,7 @@ void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) {
} }
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_0, 65)); (exec_ctx), value, grpc_stats_table_0, 64));
} }
void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) { void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) {
value = GPR_CLAMP(value, 0, 16777216); value = GPR_CLAMP(value, 0, 16777216);
@ -180,7 +180,7 @@ void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) {
} }
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_0, 65)); (exec_ctx), value, grpc_stats_table_0, 64));
} }
void grpc_stats_inc_tcp_read_iov_size(grpc_exec_ctx *exec_ctx, int value) { void grpc_stats_inc_tcp_read_iov_size(grpc_exec_ctx *exec_ctx, int value) {
value = GPR_CLAMP(value, 0, 1024); value = GPR_CLAMP(value, 0, 1024);
@ -205,7 +205,7 @@ void grpc_stats_inc_tcp_read_iov_size(grpc_exec_ctx *exec_ctx, int value) {
} }
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE, GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_2, 65)); (exec_ctx), value, grpc_stats_table_2, 64));
} }
void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx,
int value) { int value) {
@ -232,7 +232,7 @@ void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx,
GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_INC_HISTOGRAM((exec_ctx),
GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE, GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE,
grpc_stats_histo_find_bucket_slow( grpc_stats_histo_find_bucket_slow(
(exec_ctx), value, grpc_stats_table_0, 65)); (exec_ctx), value, grpc_stats_table_0, 64));
} }
const int grpc_stats_histo_buckets[6] = {64, 64, 64, 64, 64, 64}; const int grpc_stats_histo_buckets[6] = {64, 64, 64, 64, 64, 64};
const int grpc_stats_histo_start[6] = {0, 64, 128, 192, 256, 320}; const int grpc_stats_histo_start[6] = {0, 64, 128, 192, 256, 320};

@ -70,7 +70,7 @@ static int FindExpectedBucket(int i, int j) {
return 0; return 0;
} }
if (j >= if (j >=
grpc_stats_histo_bucket_boundaries[i][grpc_stats_histo_buckets[i] - 1]) { grpc_stats_histo_bucket_boundaries[i][grpc_stats_histo_buckets[i]]) {
return grpc_stats_histo_buckets[i] - 1; return grpc_stats_histo_buckets[i] - 1;
} }
return std::upper_bound(grpc_stats_histo_bucket_boundaries[i], return std::upper_bound(grpc_stats_histo_bucket_boundaries[i],

@ -155,7 +155,7 @@ def gen_bucket_code(histogram):
code += 'return;\n' code += 'return;\n'
code += '}\n' code += '}\n'
code += 'GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_%s, '% histogram.name.upper() code += 'GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_%s, '% histogram.name.upper()
code += 'grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_%d, %d));\n' % (bounds_idx, len(bounds)) code += 'grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_%d, %d));\n' % (bounds_idx, histogram.buckets)
return (code, bounds_idx) return (code, bounds_idx)
# utility: print a big comment block into a set of files # utility: print a big comment block into a set of files

Loading…
Cancel
Save