Expose more stats

pull/12358/head
Craig Tiller 7 years ago
parent 57bb9a9c35
commit c92f18ce86
  1. 10
      src/core/lib/debug/stats_data.c
  2. 39
      src/core/lib/debug/stats_data.h
  3. 3
      src/core/lib/debug/stats_data.yaml
  4. 1
      src/core/lib/iomgr/tcp_posix.c

@ -48,7 +48,7 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = {
};
const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = {
"tcp_write_size", "tcp_write_iov_size", "tcp_read_size",
"tcp_read_iov_size", "http2_send_message_size",
"tcp_read_offer", "tcp_read_iov_size", "http2_send_message_size",
};
const double grpc_stats_table_0[64] = {0,
1,
@ -188,8 +188,8 @@ const uint8_t grpc_stats_table_3[52] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52};
const int grpc_stats_histo_buckets[5] = {64, 64, 64, 64, 64};
const int grpc_stats_histo_start[5] = {0, 64, 128, 192, 256};
const double *const grpc_stats_histo_bucket_boundaries[5] = {
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 double *const grpc_stats_histo_bucket_boundaries[6] = {
grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_0,
grpc_stats_table_2, grpc_stats_table_0};
grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_0};

@ -56,6 +56,7 @@ typedef enum {
GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE,
GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE,
GRPC_STATS_HISTOGRAM_TCP_READ_SIZE,
GRPC_STATS_HISTOGRAM_TCP_READ_OFFER,
GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE,
GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE,
GRPC_STATS_HISTOGRAM_COUNT
@ -68,11 +69,13 @@ typedef enum {
GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE_BUCKETS = 64,
GRPC_STATS_HISTOGRAM_TCP_READ_SIZE_FIRST_SLOT = 128,
GRPC_STATS_HISTOGRAM_TCP_READ_SIZE_BUCKETS = 64,
GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE_FIRST_SLOT = 192,
GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_FIRST_SLOT = 192,
GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_BUCKETS = 64,
GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE_FIRST_SLOT = 256,
GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE_BUCKETS = 64,
GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_FIRST_SLOT = 256,
GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_FIRST_SLOT = 320,
GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_BUCKETS = 64,
GRPC_STATS_HISTOGRAM_BUCKETS = 320
GRPC_STATS_HISTOGRAM_BUCKETS = 384
} grpc_stats_histogram_constants;
#define GRPC_STATS_INC_CLIENT_CALLS_CREATED(exec_ctx) \
GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED)
@ -207,6 +210,30 @@ typedef enum {
} \
} \
} while (false)
#define GRPC_STATS_INC_TCP_READ_OFFER(exec_ctx, value) \
do { \
union { \
double dbl; \
uint64_t uint; \
} _val; \
_val.dbl = (double)(value); \
if (_val.dbl < 0) _val.dbl = 0; \
if (_val.dbl < 5.000000) { \
GRPC_STATS_INC_HISTOGRAM( \
(exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, (int)_val.dbl); \
} else { \
if (_val.uint < 4715268809856909312ull) { \
GRPC_STATS_INC_HISTOGRAM( \
(exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, \
grpc_stats_table_1[((_val.uint - 4617315517961601024ull) >> 50)]); \
} else { \
GRPC_STATS_INC_HISTOGRAM( \
(exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, \
grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \
grpc_stats_table_0, 64)); \
} \
} \
} while (false)
#define GRPC_STATS_INC_TCP_READ_IOV_SIZE(exec_ctx, value) \
do { \
union { \
@ -260,8 +287,8 @@ extern const double grpc_stats_table_0[64];
extern const uint8_t grpc_stats_table_1[87];
extern const double grpc_stats_table_2[64];
extern const uint8_t grpc_stats_table_3[52];
extern const int grpc_stats_histo_buckets[5];
extern const int grpc_stats_histo_start[5];
extern const double *const grpc_stats_histo_bucket_boundaries[5];
extern const int grpc_stats_histo_buckets[6];
extern const int grpc_stats_histo_start[6];
extern const double *const grpc_stats_histo_bucket_boundaries[6];
#endif /* GRPC_CORE_LIB_DEBUG_STATS_DATA_H */

@ -21,6 +21,9 @@
- histogram: tcp_read_size
max: 16777216
buckets: 64
- histogram: tcp_read_offer
max: 16777216
buckets: 64
- histogram: tcp_read_iov_size
max: 1024
buckets: 64

@ -255,6 +255,7 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
msg.msg_controllen = 0;
msg.msg_flags = 0;
GRPC_STATS_INC_TCP_READ_OFFER(exec_ctx, tcp->incoming_buffer->length);
GRPC_STATS_INC_TCP_READ_IOV_SIZE(exec_ctx, tcp->incoming_buffer->count);
GPR_TIMER_BEGIN("recvmsg", 0);

Loading…
Cancel
Save