From 0ff222a23b94a34d03d1cfa4b5c148406e441f4c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 1 Sep 2017 09:41:43 -0700 Subject: Add pollset_kick stats --- src/core/lib/debug/stats_data.c | 243 ++++++++++++++++++++- src/core/lib/debug/stats_data.h | 128 ++++++++--- src/core/lib/debug/stats_data.yaml | 12 + src/core/lib/iomgr/ev_epoll1_linux.c | 25 ++- .../lib/iomgr/ev_epoll_limited_pollers_linux.c | 5 +- src/core/lib/iomgr/ev_epoll_thread_pool_linux.c | 5 +- src/core/lib/iomgr/ev_epollex_linux.c | 9 +- src/core/lib/iomgr/ev_epollsig_linux.c | 5 +- src/core/lib/iomgr/ev_poll_posix.c | 46 ++-- src/core/lib/iomgr/ev_posix.c | 4 +- src/core/lib/iomgr/ev_posix.h | 2 +- src/core/lib/iomgr/pollset.h | 2 +- .../google_default/google_default_credentials.c | 3 +- src/core/lib/surface/call.c | 5 +- src/core/lib/surface/completion_queue.c | 11 +- 15 files changed, 425 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/core/lib/debug/stats_data.c b/src/core/lib/debug/stats_data.c index 9277ee57b2..445dcb67a3 100644 --- a/src/core/lib/debug/stats_data.c +++ b/src/core/lib/debug/stats_data.c @@ -24,6 +24,12 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "server_calls_created", "syscall_poll", "syscall_wait", + "pollset_kick", + "pollset_kicked_without_poller", + "pollset_kicked_again", + "pollset_kick_wakeup_fd", + "pollset_kick_wakeup_cv", + "pollset_kick_own_thread", "histogram_slow_lookups", "syscall_write", "syscall_read", @@ -47,10 +53,226 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "executor_queue_drained", }; const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { - "tcp_write_size", "tcp_write_iov_size", "tcp_read_size", - "tcp_read_offer", "tcp_read_iov_size", "http2_send_message_size", + "call_initial_size", "poll_events_returned", "tcp_write_size", + "tcp_write_iov_size", "tcp_read_size", "tcp_read_offer", + "tcp_read_iov_size", "http2_send_message_size", }; const double grpc_stats_table_0[64] = {0, + 1, + 2, + 3, + 4, + 5, + 6.03034139457, + 7.27300346702, + 8.77173877401, + 10.5793158863, + 12.759377303, + 15.3886802239, + 18.5597990724, + 22.3843849243, + 26.9970966002, + 32.5603418323, + 39.2699954346, + 47.3622958068, + 57.1221625891, + 68.8932283217, + 83.0899373109, + 100.212137688, + 120.862680427, + 145.768644968, + 175.806938756, + 212.035172047, + 255.72889502, + 308.426508286, + 371.98342802, + 448.637412817, + 541.087352333, + 652.588291771, + 787.066037897, + 949.255381718, + 1144.86680448, + 1380.78753647, + 1665.32404765, + 2008.49450799, + 2422.38151446, + 2921.55750402, + 3523.59783062, + 4249.69957117, + 5125.4278477, + 6181.61594298, + 7455.45090126, + 8991.78283702, + 10844.7040506, + 13079.4535497, + 15774.7140318, + 19025.3822027, + 22945.9099689, + 27674.3341444, + 33377.1365516, + 40255.1056359, + 48550.4059718, + 58555.104571, + 70621.4541917, + 85174.2957114, + 102726.016236, + 123894.589602, + 149425.334448, + 180217.155944, + 217354.195101, + 262144.0}; +const uint8_t grpc_stats_table_1[124] = { + 0, 2, 2, 4, 4, 6, 6, 8, 8, 11, 11, 11, 13, 13, + 15, 15, 17, 17, 20, 20, 20, 21, 23, 23, 26, 26, 26, 28, + 28, 30, 30, 32, 32, 35, 35, 35, 37, 37, 38, 41, 41, 41, + 43, 43, 45, 45, 47, 47, 50, 50, 50, 52, 52, 54, 54, 56, + 56, 58, 58, 60, 60, 62, 62, 65, 65, 65, 67, 67, 69, 69, + 71, 71, 73, 73, 76, 76, 76, 78, 78, 80, 80, 82, 82, 84, + 84, 86, 86, 88, 88, 91, 91, 91, 93, 93, 95, 95, 97, 97, + 100, 100, 100, 101, 103, 103, 106, 106, 106, 108, 108, 110, 110, 112, + 112, 115, 115, 115, 117, 117, 118, 121, 121, 121, 124, 124}; +const double grpc_stats_table_2[128] = {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.0367057593, + 30.1117957626, + 31.2266911945, + 32.382865859, + 33.5818481283, + 34.8252229627, + 36.1146340061, + 37.4517857586, + 38.8384458298, + 40.2764472753, + 41.7676910202, + 43.3141483714, + 44.9178636242, + 46.580956764, + 48.3056262695, + 50.0941520181, + 51.9488983005, + 53.8723169454, + 55.8669505614, + 57.9354358972, + 60.0805073281, + 62.3050004699, + 64.6118559278, + 67.0041231836, + 69.4849646266, + 72.0576597342, + 74.7256094075, + 77.4923404661, + 80.3615103113, + 83.3369117602, + 86.4224780597, + 89.6222880862, + 92.940571737, + 96.3817155226, + 99.9502683646, + 103.65094761, + 107.488645265, + 111.468434465, + 115.595576179, + 119.875526164, + 124.313942178, + 128.916691457, + 133.689858475, + 138.639752984, + 143.772918355, + 149.09614023, + 154.616455489, + 160.341161557, + 166.277826044, + 172.434296755, + 178.818712061, + 185.439511656, + 192.305447719, + 199.425596476, + 206.809370205, + 214.466529676, + 222.407197051, + 230.641869269, + 239.181431919, + 248.037173633, + 257.220801006, + 266.744454071, + 276.62072235, + 286.862661493, + 297.48381054, + 308.498209814, + 319.920419488, + 331.765538824, + 344.04922614, + 356.787719506, + 369.997858208, + 383.697105013, + 397.903569249, + 412.636030746, + 427.913964659, + 443.757567219, + 460.187782422, + 477.226329722, + 494.895732741, + 513.219349041, + 532.221401003, + 551.927007848, + 572.36221884, + 593.554047722, + 615.530508428, + 638.320652111, + 661.954605552, + 686.46361098, + 711.880067376, + 738.237573297, + 765.570971297, + 793.91639398, + 823.311311768, + 853.794582433, + 885.406502465, + 918.188860339, + 952.184991756, + 987.439836931, + 1024.0}; +const uint8_t grpc_stats_table_3[166] = { + 0, 2, 2, 4, 4, 6, 6, 7, 8, 10, 10, 11, 12, 14, + 14, 15, 17, 17, 18, 20, 20, 22, 22, 24, 24, 25, 27, 27, + 29, 29, 31, 31, 34, 34, 34, 36, 36, 38, 38, 39, 40, 42, + 42, 43, 44, 46, 46, 47, 49, 49, 50, 52, 52, 54, 54, 55, + 57, 57, 59, 59, 61, 61, 63, 63, 65, 65, 68, 68, 68, 70, + 70, 71, 72, 73, 75, 75, 76, 78, 78, 79, 81, 81, 82, 84, + 84, 86, 86, 87, 89, 89, 91, 91, 93, 93, 95, 95, 97, 97, + 100, 100, 100, 102, 102, 103, 104, 105, 107, 107, 108, 109, 111, 111, + 113, 113, 114, 116, 116, 117, 119, 119, 121, 121, 123, 123, 125, 125, + 127, 127, 129, 129, 131, 131, 134, 134, 134, 135, 136, 137, 139, 139, + 140, 141, 143, 143, 144, 146, 146, 148, 148, 149, 151, 151, 153, 153, + 155, 155, 157, 157, 159, 159, 161, 161, 163, 163, 166, 166}; +const double grpc_stats_table_4[64] = {0, 1, 2, 3, @@ -114,13 +336,13 @@ const double grpc_stats_table_0[64] = {0, 10005134.9318, 12956014.428, 16777216.0}; -const uint8_t grpc_stats_table_1[87] = { +const uint8_t grpc_stats_table_5[87] = { 0, 1, 3, 3, 4, 6, 6, 7, 9, 9, 10, 12, 12, 13, 15, 15, 16, 18, 18, 19, 21, 21, 22, 24, 24, 25, 27, 27, 28, 30, 30, 31, 32, 34, 34, 36, 36, 37, 39, 39, 40, 42, 42, 43, 44, 46, 46, 47, 49, 49, 51, 51, 52, 53, 55, 55, 56, 58, 58, 59, 61, 61, 63, 63, 64, 65, 67, 67, 68, 70, 70, 71, 73, 73, 75, 75, 76, 77, 79, 79, 80, 82, 82, 83, 85, 85, 87}; -const double grpc_stats_table_2[64] = {0, +const double grpc_stats_table_6[64] = {0, 1, 2, 3, @@ -184,12 +406,13 @@ const double grpc_stats_table_2[64] = {0, 860.147148411, 938.504491184, 1024.0}; -const uint8_t grpc_stats_table_3[52] = { +const uint8_t grpc_stats_table_7[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[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_0, grpc_stats_table_2, grpc_stats_table_0}; +const int grpc_stats_histo_buckets[8] = {64, 128, 64, 64, 64, 64, 64, 64}; +const int grpc_stats_histo_start[8] = {0, 64, 192, 256, 320, 384, 448, 512}; +const double *const grpc_stats_histo_bucket_boundaries[8] = { + grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_4, + grpc_stats_table_6, grpc_stats_table_4, grpc_stats_table_4, + grpc_stats_table_6, grpc_stats_table_4}; diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index 4d1078dfdb..17e5f22e6c 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -28,6 +28,12 @@ typedef enum { GRPC_STATS_COUNTER_SERVER_CALLS_CREATED, GRPC_STATS_COUNTER_SYSCALL_POLL, GRPC_STATS_COUNTER_SYSCALL_WAIT, + GRPC_STATS_COUNTER_POLLSET_KICK, + GRPC_STATS_COUNTER_POLLSET_KICKED_WITHOUT_POLLER, + GRPC_STATS_COUNTER_POLLSET_KICKED_AGAIN, + GRPC_STATS_COUNTER_POLLSET_KICK_WAKEUP_FD, + GRPC_STATS_COUNTER_POLLSET_KICK_WAKEUP_CV, + GRPC_STATS_COUNTER_POLLSET_KICK_OWN_THREAD, GRPC_STATS_COUNTER_HISTOGRAM_SLOW_LOOKUPS, GRPC_STATS_COUNTER_SYSCALL_WRITE, GRPC_STATS_COUNTER_SYSCALL_READ, @@ -53,6 +59,8 @@ typedef enum { } grpc_stats_counters; extern const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]; typedef enum { + GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, + GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, @@ -63,19 +71,23 @@ typedef enum { } grpc_stats_histograms; extern const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT]; typedef enum { - GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE_FIRST_SLOT = 0, + GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE_FIRST_SLOT = 0, + GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE_BUCKETS = 64, + GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED_FIRST_SLOT = 64, + GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED_BUCKETS = 128, + GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE_FIRST_SLOT = 192, GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE_FIRST_SLOT = 64, + GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE_FIRST_SLOT = 256, GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_TCP_READ_SIZE_FIRST_SLOT = 128, + GRPC_STATS_HISTOGRAM_TCP_READ_SIZE_FIRST_SLOT = 320, GRPC_STATS_HISTOGRAM_TCP_READ_SIZE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_FIRST_SLOT = 192, + GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_FIRST_SLOT = 384, 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_FIRST_SLOT = 448, GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_FIRST_SLOT = 320, + GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_FIRST_SLOT = 512, GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_BUCKETS = 384 + GRPC_STATS_HISTOGRAM_BUCKETS = 576 } 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) @@ -85,6 +97,19 @@ typedef enum { GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_SYSCALL_POLL) #define GRPC_STATS_INC_SYSCALL_WAIT(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_SYSCALL_WAIT) +#define GRPC_STATS_INC_POLLSET_KICK(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_POLLSET_KICK) +#define GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), \ + GRPC_STATS_COUNTER_POLLSET_KICKED_WITHOUT_POLLER) +#define GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_POLLSET_KICKED_AGAIN) +#define GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_POLLSET_KICK_WAKEUP_FD) +#define GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_POLLSET_KICK_WAKEUP_CV) +#define GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_POLLSET_KICK_OWN_THREAD) #define GRPC_STATS_INC_HISTOGRAM_SLOW_LOOKUPS(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_HISTOGRAM_SLOW_LOOKUPS) #define GRPC_STATS_INC_SYSCALL_WRITE(exec_ctx) \ @@ -138,6 +163,55 @@ typedef enum { GRPC_STATS_COUNTER_EXECUTOR_WAKEUP_INITIATED) #define GRPC_STATS_INC_EXECUTOR_QUEUE_DRAINED(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_QUEUE_DRAINED) +#define GRPC_STATS_INC_CALL_INITIAL_SIZE(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 < 6.000000) { \ + GRPC_STATS_INC_HISTOGRAM( \ + (exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, (int)_val.dbl); \ + } else { \ + if (_val.uint < 4688247212092686336ull) { \ + GRPC_STATS_INC_HISTOGRAM( \ + (exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, \ + grpc_stats_table_1[((_val.uint - 4618441417868443648ull) >> 49)]); \ + } else { \ + GRPC_STATS_INC_HISTOGRAM( \ + (exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, \ + grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ + grpc_stats_table_0, 64)); \ + } \ + } \ + } while (false) +#define GRPC_STATS_INC_POLL_EVENTS_RETURNED(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 < 29.000000) { \ + GRPC_STATS_INC_HISTOGRAM((exec_ctx), \ + GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, \ + (int)_val.dbl); \ + } else { \ + if (_val.uint < 4652218415073722368ull) { \ + GRPC_STATS_INC_HISTOGRAM( \ + (exec_ctx), GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, \ + grpc_stats_table_3[((_val.uint - 4628855992006737920ull) >> 47)]); \ + } else { \ + GRPC_STATS_INC_HISTOGRAM( \ + (exec_ctx), GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, \ + grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ + grpc_stats_table_2, 128)); \ + } \ + } \ + } while (false) #define GRPC_STATS_INC_TCP_WRITE_SIZE(exec_ctx, value) \ do { \ union { \ @@ -153,12 +227,12 @@ typedef enum { if (_val.uint < 4715268809856909312ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, \ - grpc_stats_table_1[((_val.uint - 4617315517961601024ull) >> 50)]); \ + grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)]); \ } else { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, \ grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ - grpc_stats_table_0, 64)); \ + grpc_stats_table_4, 64)); \ } \ } \ } while (false) @@ -177,12 +251,12 @@ typedef enum { if (_val.uint < 4652218415073722368ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, \ - grpc_stats_table_3[((_val.uint - 4622945017495814144ull) >> 49)]); \ + grpc_stats_table_7[((_val.uint - 4622945017495814144ull) >> 49)]); \ } else { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, \ grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ - grpc_stats_table_2, 64)); \ + grpc_stats_table_6, 64)); \ } \ } \ } while (false) @@ -201,12 +275,12 @@ typedef enum { if (_val.uint < 4715268809856909312ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, \ - grpc_stats_table_1[((_val.uint - 4617315517961601024ull) >> 50)]); \ + grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)]); \ } else { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, \ grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ - grpc_stats_table_0, 64)); \ + grpc_stats_table_4, 64)); \ } \ } \ } while (false) @@ -225,12 +299,12 @@ typedef enum { if (_val.uint < 4715268809856909312ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, \ - grpc_stats_table_1[((_val.uint - 4617315517961601024ull) >> 50)]); \ + grpc_stats_table_5[((_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)); \ + grpc_stats_table_4, 64)); \ } \ } \ } while (false) @@ -249,12 +323,12 @@ typedef enum { if (_val.uint < 4652218415073722368ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE, \ - grpc_stats_table_3[((_val.uint - 4622945017495814144ull) >> 49)]); \ + grpc_stats_table_7[((_val.uint - 4622945017495814144ull) >> 49)]); \ } else { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_IOV_SIZE, \ grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ - grpc_stats_table_2, 64)); \ + grpc_stats_table_6, 64)); \ } \ } \ } while (false) @@ -274,21 +348,25 @@ typedef enum { if (_val.uint < 4715268809856909312ull) { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE, \ - grpc_stats_table_1[((_val.uint - 4617315517961601024ull) >> 50)]); \ + grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)]); \ } else { \ GRPC_STATS_INC_HISTOGRAM( \ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE, \ grpc_stats_histo_find_bucket_slow((exec_ctx), _val.dbl, \ - grpc_stats_table_0, 64)); \ + grpc_stats_table_4, 64)); \ } \ } \ } while (false) 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[6]; -extern const int grpc_stats_histo_start[6]; -extern const double *const grpc_stats_histo_bucket_boundaries[6]; +extern const uint8_t grpc_stats_table_1[124]; +extern const double grpc_stats_table_2[128]; +extern const uint8_t grpc_stats_table_3[166]; +extern const double grpc_stats_table_4[64]; +extern const uint8_t grpc_stats_table_5[87]; +extern const double grpc_stats_table_6[64]; +extern const uint8_t grpc_stats_table_7[52]; +extern const int grpc_stats_histo_buckets[8]; +extern const int grpc_stats_histo_start[8]; +extern const double *const grpc_stats_histo_bucket_boundaries[8]; #endif /* GRPC_CORE_LIB_DEBUG_STATS_DATA_H */ diff --git a/src/core/lib/debug/stats_data.yaml b/src/core/lib/debug/stats_data.yaml index a0d042a688..4e0bc5de58 100644 --- a/src/core/lib/debug/stats_data.yaml +++ b/src/core/lib/debug/stats_data.yaml @@ -18,9 +18,21 @@ # overall - counter: client_calls_created - counter: server_calls_created +- histogram: call_initial_size + max: 262144 + buckets: 64 # polling - counter: syscall_poll - counter: syscall_wait +- histogram: poll_events_returned + max: 1024 + buckets: 128 +- counter: pollset_kick +- counter: pollset_kicked_without_poller +- counter: pollset_kicked_again +- counter: pollset_kick_wakeup_fd +- counter: pollset_kick_wakeup_cv +- counter: pollset_kick_own_thread # stats system - counter: histogram_slow_lookups # tcp diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 7f053fa728..6a3c2654a8 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -502,12 +502,14 @@ static void pollset_destroy(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { gpr_mu_destroy(&pollset->mu); } -static grpc_error *pollset_kick_all(grpc_pollset *pollset) { +static grpc_error *pollset_kick_all(grpc_exec_ctx *exec_ctx, + grpc_pollset *pollset) { GPR_TIMER_BEGIN("pollset_kick_all", 0); grpc_error *error = GRPC_ERROR_NONE; if (pollset->root_worker != NULL) { grpc_pollset_worker *worker = pollset->root_worker; do { + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); switch (worker->kick_state) { case KICKED: break; @@ -550,7 +552,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(!pollset->shutting_down); pollset->shutdown_closure = closure; pollset->shutting_down = true; - GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(pollset)); + GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(exec_ctx, pollset)); pollset_maybe_finish_shutdown(exec_ctx, pollset); GPR_TIMER_END("pollset_shutdown", 0); } @@ -646,6 +648,8 @@ static grpc_error *do_epoll_wait(grpc_exec_ctx *exec_ctx, grpc_pollset *ps, if (r < 0) return GRPC_OS_ERROR(errno, "epoll_wait"); + GRPC_STATS_INC_POLL_EVENTS_RETURNED(exec_ctx, r); + if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_DEBUG, "ps: %p poll got %d events", ps, r); } @@ -971,9 +975,10 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *ps, return error; } -static grpc_error *pollset_kick(grpc_pollset *pollset, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { GPR_TIMER_BEGIN("pollset_kick", 0); + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); grpc_error *ret_err = GRPC_ERROR_NONE; if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_strvec log; @@ -1005,6 +1010,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)pollset) { grpc_pollset_worker *root_worker = pollset->root_worker; if (root_worker == NULL) { + GRPC_STATS_INC_POLLSET_KICKED_WITHOUT_POLLER(exec_ctx); pollset->kicked_without_poller = true; if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kicked_without_poller"); @@ -1013,12 +1019,14 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, } grpc_pollset_worker *next_worker = root_worker->next; if (root_worker->kick_state == KICKED) { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. already kicked %p", root_worker); } SET_KICK_STATE(root_worker, KICKED); goto done; } else if (next_worker->kick_state == KICKED) { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. already kicked %p", next_worker); } @@ -1029,6 +1037,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, // there is no next worker root_worker == (grpc_pollset_worker *)gpr_atm_no_barrier_load( &g_active_poller)) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kicked %p", root_worker); } @@ -1036,6 +1045,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd); goto done; } else if (next_worker->kick_state == UNKICKED) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kicked %p", next_worker); } @@ -1053,10 +1063,12 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, } SET_KICK_STATE(root_worker, KICKED); if (root_worker->initialized_cv) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); gpr_cv_signal(&root_worker->cv); } goto done; } else { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. non-root poller %p (root=%p)", next_worker, root_worker); @@ -1066,23 +1078,27 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, goto done; } } else { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); GPR_ASSERT(next_worker->kick_state == KICKED); SET_KICK_STATE(next_worker, KICKED); goto done; } } else { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kicked while waking up"); } goto done; } } else if (specific_worker->kick_state == KICKED) { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. specific worker already kicked"); } goto done; } else if (gpr_tls_get(&g_current_thread_worker) == (intptr_t)specific_worker) { + GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. mark %p kicked", specific_worker); } @@ -1090,6 +1106,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, goto done; } else if (specific_worker == (grpc_pollset_worker *)gpr_atm_no_barrier_load(&g_active_poller)) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kick active poller"); } @@ -1097,6 +1114,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, ret_err = grpc_wakeup_fd_wakeup(&global_wakeup_fd); goto done; } else if (specific_worker->initialized_cv) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kick waiting worker"); } @@ -1104,6 +1122,7 @@ static grpc_error *pollset_kick(grpc_pollset *pollset, gpr_cv_signal(&specific_worker->cv); goto done; } else { + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kick non-waiting worker"); } diff --git a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c index e2e3cd9003..ee3250297f 100644 --- a/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +++ b/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c @@ -1112,12 +1112,13 @@ static void push_front_worker(grpc_pollset *p, grpc_pollset_worker *worker) { } /* p->mu must be held before calling this function */ -static grpc_error *pollset_kick(grpc_pollset *p, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker) { GPR_TIMER_BEGIN("pollset_kick", 0); grpc_error *error = GRPC_ERROR_NONE; const char *err_desc = "Kick Failure"; grpc_pollset_worker *worker = specific_worker; + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); if (worker != NULL) { if (worker == GRPC_POLLSET_KICK_BROADCAST) { if (pollset_has_workers(p)) { @@ -1265,7 +1266,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(!pollset->shutting_down); pollset->shutting_down = true; pollset->shutdown_done = closure; - pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); + pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST); /* If the pollset has any workers, we cannot call finish_shutdown_locked() because it would release the underlying polling island. In such a case, we diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c index ddb8c74d2d..ace491550b 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c @@ -632,9 +632,10 @@ static void push_front_worker(grpc_pollset *p, grpc_pollset_worker *worker) { } /* p->mu must be held before calling this function */ -static grpc_error *pollset_kick(grpc_pollset *p, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker) { GPR_TIMER_BEGIN("pollset_kick", 0); + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); grpc_error *error = GRPC_ERROR_NONE; const char *err_desc = "Kick Failure"; grpc_pollset_worker *worker = specific_worker; @@ -731,7 +732,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(!pollset->shutting_down); pollset->shutting_down = true; pollset->shutdown_done = closure; - pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); + pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST); /* If the pollset has any workers, we cannot call finish_shutdown_locked() because it would release the underlying epoll set. In such a case, we diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index 0e42f76af3..165a562bd7 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -561,6 +561,7 @@ static void do_kick_all(grpc_exec_ctx *exec_ctx, void *arg, if (pollset->root_worker != NULL) { grpc_pollset_worker *worker = pollset->root_worker; do { + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); if (worker->pollable != &pollset->pollable) { gpr_mu_lock(&worker->pollable->po.mu); } @@ -599,7 +600,8 @@ static void pollset_kick_all(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { GRPC_ERROR_NONE); } -static grpc_error *pollset_kick_inner(grpc_pollset *pollset, pollable *p, +static grpc_error *pollset_kick_inner(grpc_exec_ctx *exec_ctx, + grpc_pollset *pollset, pollable *p, grpc_pollset_worker *specific_worker) { if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_DEBUG, @@ -662,13 +664,14 @@ static grpc_error *pollset_kick_inner(grpc_pollset *pollset, pollable *p, } /* p->po.mu must be held before calling this function */ -static grpc_error *pollset_kick(grpc_pollset *pollset, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { pollable *p = pollset->current_pollable; + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); if (p != &pollset->pollable) { gpr_mu_lock(&p->po.mu); } - grpc_error *error = pollset_kick_inner(pollset, p, specific_worker); + grpc_error *error = pollset_kick_inner(exec_ctx, pollset, p, specific_worker); if (p != &pollset->pollable) { gpr_mu_unlock(&p->po.mu); } diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 59c7cdc285..6cc9645526 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -1020,10 +1020,11 @@ static void push_front_worker(grpc_pollset *p, grpc_pollset_worker *worker) { } /* p->mu must be held before calling this function */ -static grpc_error *pollset_kick(grpc_pollset *p, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker) { GPR_TIMER_BEGIN("pollset_kick", 0); grpc_error *error = GRPC_ERROR_NONE; + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); const char *err_desc = "Kick Failure"; grpc_pollset_worker *worker = specific_worker; if (worker != NULL) { @@ -1157,7 +1158,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(!pollset->shutting_down); pollset->shutting_down = true; pollset->shutdown_done = closure; - pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); + pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST); /* If the pollset has any workers, we cannot call finish_shutdown_locked() because it would release the underlying polling island. In such a case, we diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index fbd265f3ce..78817144af 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -209,7 +209,7 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, #define GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP 2 /* As per pollset_kick, with an extended set of flags (defined above) -- mostly for fd_posix's use. */ -static grpc_error *pollset_kick_ext(grpc_pollset *p, +static grpc_error *pollset_kick_ext(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker, uint32_t flags) GRPC_MUST_USE_RESULT; @@ -365,36 +365,39 @@ static grpc_pollset *fd_get_read_notifier_pollset(grpc_exec_ctx *exec_ctx, return notifier; } -static grpc_error *pollset_kick_locked(grpc_fd_watcher *watcher) { +static grpc_error *pollset_kick_locked(grpc_exec_ctx *exec_ctx, + grpc_fd_watcher *watcher) { gpr_mu_lock(&watcher->pollset->mu); GPR_ASSERT(watcher->worker); - grpc_error *err = pollset_kick_ext(watcher->pollset, watcher->worker, - GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP); + grpc_error *err = + pollset_kick_ext(exec_ctx, watcher->pollset, watcher->worker, + GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP); gpr_mu_unlock(&watcher->pollset->mu); return err; } -static void maybe_wake_one_watcher_locked(grpc_fd *fd) { +static void maybe_wake_one_watcher_locked(grpc_exec_ctx *exec_ctx, + grpc_fd *fd) { if (fd->inactive_watcher_root.next != &fd->inactive_watcher_root) { - pollset_kick_locked(fd->inactive_watcher_root.next); + pollset_kick_locked(exec_ctx, fd->inactive_watcher_root.next); } else if (fd->read_watcher) { - pollset_kick_locked(fd->read_watcher); + pollset_kick_locked(exec_ctx, fd->read_watcher); } else if (fd->write_watcher) { - pollset_kick_locked(fd->write_watcher); + pollset_kick_locked(exec_ctx, fd->write_watcher); } } -static void wake_all_watchers_locked(grpc_fd *fd) { +static void wake_all_watchers_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { grpc_fd_watcher *watcher; for (watcher = fd->inactive_watcher_root.next; watcher != &fd->inactive_watcher_root; watcher = watcher->next) { - pollset_kick_locked(watcher); + pollset_kick_locked(exec_ctx, watcher); } if (fd->read_watcher) { - pollset_kick_locked(fd->read_watcher); + pollset_kick_locked(exec_ctx, fd->read_watcher); } if (fd->write_watcher && fd->write_watcher != fd->read_watcher) { - pollset_kick_locked(fd->write_watcher); + pollset_kick_locked(exec_ctx, fd->write_watcher); } } @@ -435,7 +438,7 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, if (!has_watchers(fd)) { close_fd_locked(exec_ctx, fd); } else { - wake_all_watchers_locked(fd); + wake_all_watchers_locked(exec_ctx, fd); } gpr_mu_unlock(&fd->mu); UNREF_BY(fd, 2, reason); /* drop the reference */ @@ -479,7 +482,7 @@ static void notify_on_locked(grpc_exec_ctx *exec_ctx, grpc_fd *fd, /* already ready ==> queue the closure to run immediately */ *st = CLOSURE_NOT_READY; GRPC_CLOSURE_SCHED(exec_ctx, closure, fd_shutdown_error(fd)); - maybe_wake_one_watcher_locked(fd); + maybe_wake_one_watcher_locked(exec_ctx, fd); } else { /* upcallptr was set to a different closure. This is an error! */ gpr_log(GPR_ERROR, @@ -648,7 +651,7 @@ static void fd_end_poll(grpc_exec_ctx *exec_ctx, grpc_fd_watcher *watcher, } } if (kick) { - maybe_wake_one_watcher_locked(fd); + maybe_wake_one_watcher_locked(exec_ctx, fd); } if (fd_is_orphaned(fd) && !has_watchers(fd) && !fd->closed) { close_fd_locked(exec_ctx, fd); @@ -712,11 +715,12 @@ static void kick_append_error(grpc_error **composite, grpc_error *error) { *composite = grpc_error_add_child(*composite, error); } -static grpc_error *pollset_kick_ext(grpc_pollset *p, +static grpc_error *pollset_kick_ext(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker, uint32_t flags) { GPR_TIMER_BEGIN("pollset_kick_ext", 0); grpc_error *error = GRPC_ERROR_NONE; + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); /* pollset->mu already held */ if (specific_worker != NULL) { @@ -782,9 +786,9 @@ static grpc_error *pollset_kick_ext(grpc_pollset *p, return error; } -static grpc_error *pollset_kick(grpc_pollset *p, +static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker) { - return pollset_kick_ext(p, specific_worker, 0); + return pollset_kick_ext(exec_ctx, p, specific_worker, 0); } /* global state management */ @@ -847,7 +851,7 @@ static void pollset_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, } pollset->fds[pollset->fd_count++] = fd; GRPC_FD_REF(fd, "multipoller"); - pollset_kick(pollset, NULL); + pollset_kick(exec_ctx, pollset, NULL); exit: gpr_mu_unlock(&pollset->mu); } @@ -1070,7 +1074,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, /* check shutdown conditions */ if (pollset->shutting_down) { if (pollset_has_workers(pollset)) { - pollset_kick(pollset, NULL); + pollset_kick(exec_ctx, pollset, NULL); } else if (!pollset->called_shutdown && !pollset_has_observers(pollset)) { pollset->called_shutdown = 1; gpr_mu_unlock(&pollset->mu); @@ -1099,7 +1103,7 @@ static void pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(!pollset->shutting_down); pollset->shutting_down = 1; pollset->shutdown_done = closure; - pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); + pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST); if (!pollset_has_workers(pollset)) { GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pollset->idle_jobs); } diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 424b40e425..32363765e3 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -214,9 +214,9 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, return g_event_engine->pollset_work(exec_ctx, pollset, worker, now, deadline); } -grpc_error *grpc_pollset_kick(grpc_pollset *pollset, +grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { - return g_event_engine->pollset_kick(pollset, specific_worker); + return g_event_engine->pollset_kick(exec_ctx, pollset, specific_worker); } void grpc_pollset_add_fd(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 1108e46ef8..1ff2ff1413 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -54,7 +54,7 @@ typedef struct grpc_event_engine_vtable { grpc_error *(*pollset_work)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker, gpr_timespec now, gpr_timespec deadline); - grpc_error *(*pollset_kick)(grpc_pollset *pollset, + grpc_error *(*pollset_kick)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker); void (*pollset_add_fd)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, struct grpc_fd *fd); diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index a609a3877a..a0f6b3a9d3 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -76,7 +76,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, /* Break one polling thread out of polling work for this pollset. If specific_worker is non-NULL, then kick that worker. */ -grpc_error *grpc_pollset_kick(grpc_pollset *pollset, +grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) GRPC_MUST_USE_RESULT; diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.c b/src/core/lib/security/credentials/google_default/google_default_credentials.c index a2a8e289ee..691d66df69 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.c +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.c @@ -79,7 +79,8 @@ static void on_compute_engine_detection_http_response(grpc_exec_ctx *exec_ctx, detector->is_done = 1; GRPC_LOG_IF_ERROR( "Pollset kick", - grpc_pollset_kick(grpc_polling_entity_pollset(&detector->pollent), NULL)); + grpc_pollset_kick(exec_ctx, + grpc_polling_entity_pollset(&detector->pollent), NULL)); gpr_mu_unlock(g_polling_mu); } diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index e68c201134..2599765510 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -322,8 +322,9 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, grpc_channel_get_channel_stack(args->channel); grpc_call *call; GPR_TIMER_BEGIN("grpc_call_create", 0); - gpr_arena *arena = - gpr_arena_create(grpc_channel_get_call_size_estimate(args->channel)); + size_t initial_size = grpc_channel_get_call_size_estimate(args->channel); + GRPC_STATS_INC_CALL_INITIAL_SIZE(exec_ctx, initial_size); + gpr_arena *arena = gpr_arena_create(initial_size); call = gpr_arena_alloc(arena, sizeof(grpc_call) + channel_stack->call_stack_size); gpr_ref_init(&call->ext_ref, 1); diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 10e4e5ab0c..a15b09e55d 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -54,7 +54,7 @@ typedef struct { bool can_listen; size_t (*size)(void); void (*init)(grpc_pollset *pollset, gpr_mu **mu); - grpc_error *(*kick)(grpc_pollset *pollset, + grpc_error *(*kick)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker); grpc_error *(*work)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker, gpr_timespec now, @@ -130,7 +130,8 @@ static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx, } static grpc_error *non_polling_poller_kick( - grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { + grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, + grpc_pollset_worker *specific_worker) { non_polling_poller *p = (non_polling_poller *)pollset; if (specific_worker == NULL) specific_worker = (grpc_pollset_worker *)p->root; if (specific_worker != NULL) { @@ -645,7 +646,7 @@ static void cq_end_op_for_next(grpc_exec_ctx *exec_ctx, if (is_first) { gpr_mu_lock(cq->mu); grpc_error *kick_error = - cq->poller_vtable->kick(POLLSET_FROM_CQ(cq), NULL); + cq->poller_vtable->kick(exec_ctx, POLLSET_FROM_CQ(cq), NULL); gpr_mu_unlock(cq->mu); if (kick_error != GRPC_ERROR_NONE) { @@ -731,7 +732,7 @@ static void cq_end_op_for_pluck(grpc_exec_ctx *exec_ctx, } grpc_error *kick_error = - cq->poller_vtable->kick(POLLSET_FROM_CQ(cq), pluck_worker); + cq->poller_vtable->kick(exec_ctx, POLLSET_FROM_CQ(cq), pluck_worker); gpr_mu_unlock(cq->mu); @@ -930,7 +931,7 @@ static grpc_event cq_next(grpc_completion_queue *cq, gpr_timespec deadline, if (cq_event_queue_num_items(&cqd->queue) > 0 && gpr_atm_no_barrier_load(&cqd->pending_events) > 0) { gpr_mu_lock(cq->mu); - cq->poller_vtable->kick(POLLSET_FROM_CQ(cq), NULL); + cq->poller_vtable->kick(&exec_ctx, POLLSET_FROM_CQ(cq), NULL); gpr_mu_unlock(cq->mu); } -- cgit v1.2.3 From 480f5d861264f00ee2226b2aa000bbeb268f0a29 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 09:36:07 -0700 Subject: Add missing increments --- src/core/lib/iomgr/ev_epoll1_linux.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 322fa160d0..8a984e24eb 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -512,14 +512,17 @@ static grpc_error *pollset_kick_all(grpc_exec_ctx *exec_ctx, GRPC_STATS_INC_POLLSET_KICK(exec_ctx); switch (worker->kick_state) { case KICKED: + GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); break; case UNKICKED: + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); SET_KICK_STATE(worker, KICKED); if (worker->initialized_cv) { gpr_cv_signal(&worker->cv); } break; case DESIGNATED_POLLER: + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_FD(exec_ctx); SET_KICK_STATE(worker, KICKED); append_error(&error, grpc_wakeup_fd_wakeup(&global_wakeup_fd), "pollset_kick_all"); -- cgit v1.2.3 From ebacb2f20d5b9fbf73d1f90d06eee7553c93aee6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 12:32:33 -0700 Subject: Fixes --- src/core/lib/iomgr/ev_epoll1_linux.c | 2 +- src/core/lib/iomgr/ev_epollex_linux.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index bf080fff0c..f7f6cec9ef 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -515,9 +515,9 @@ static grpc_error *pollset_kick_all(grpc_exec_ctx *exec_ctx, GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); break; case UNKICKED: - GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); SET_KICK_STATE(worker, KICKED); if (worker->initialized_cv) { + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); gpr_cv_signal(&worker->cv); } break; diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index f1a3b97f4d..4e5bed5016 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -666,12 +666,8 @@ static grpc_error *pollset_kick_inner(grpc_exec_ctx *exec_ctx, /* p->po.mu must be held before calling this function */ static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { -<<<<<<< HEAD - pollable *p = pollset->current_pollable; - GRPC_STATS_INC_POLLSET_KICK(exec_ctx); -======= pollable_t *p = pollset->current_pollable; ->>>>>>> d1fefe89dacf198a721053f2b1a3e173f1f24948 + GRPC_STATS_INC_POLLSET_KICK(exec_ctx); if (p != &pollset->pollable) { gpr_mu_lock(&p->po.mu); } -- cgit v1.2.3 From cf34fa58f476aae77c4e2dca0ff866542dd3af28 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 12:37:01 -0700 Subject: Document only epoll1 for these stats, add missing spot --- src/core/lib/debug/stats_data.c | 14 ++++++++------ src/core/lib/debug/stats_data.yaml | 6 ++++++ src/core/lib/iomgr/ev_epoll1_linux.c | 8 +++++--- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/lib/debug/stats_data.c b/src/core/lib/debug/stats_data.c index fc1ac223de..1a020a15c3 100644 --- a/src/core/lib/debug/stats_data.c +++ b/src/core/lib/debug/stats_data.c @@ -70,16 +70,18 @@ const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of server side calls created by this process", "Number of polling syscalls (epoll_wait, poll, etc) made by this process", "Number of sleeping syscalls made by this process", - "How many polling wakeups were performed by the process", - "How many times was a polling wakeup requested without an active poller", + "How many polling wakeups were performed by the process (only valid for " + "epoll1 right now)", + "How many times was a polling wakeup requested without an active poller " + "(only valid for epoll1 right now)", "How many times was the same polling worker awoken repeatedly before " - "waking up", + "waking up (only valid for epoll1 right now)", "How many times was an eventfd used as the wakeup vector for a polling " - "wakeup", + "wakeup (only valid for epoll1 right now)", "How many times was a condition variable used as the wakeup vector for a " - "polling wakeup", + "polling wakeup (only valid for epoll1 right now)", "How many times could a polling wakeup be satisfied by keeping the waking " - "thread awake?", + "thread awake? (only valid for epoll1 right now)", "Number of times histogram increments went through the slow (binary " "search) path", "Number of write syscalls (or equivalent - eg sendmsg) made by this " diff --git a/src/core/lib/debug/stats_data.yaml b/src/core/lib/debug/stats_data.yaml index 26c8e1b11d..b43c466d4f 100644 --- a/src/core/lib/debug/stats_data.yaml +++ b/src/core/lib/debug/stats_data.yaml @@ -35,20 +35,26 @@ doc: How many events are called for each syscall_poll - counter: pollset_kick doc: How many polling wakeups were performed by the process + (only valid for epoll1 right now) - counter: pollset_kicked_without_poller doc: How many times was a polling wakeup requested without an active poller + (only valid for epoll1 right now) - counter: pollset_kicked_again doc: How many times was the same polling worker awoken repeatedly before waking up + (only valid for epoll1 right now) - counter: pollset_kick_wakeup_fd doc: How many times was an eventfd used as the wakeup vector for a polling wakeup + (only valid for epoll1 right now) - counter: pollset_kick_wakeup_cv doc: How many times was a condition variable used as the wakeup vector for a polling wakeup + (only valid for epoll1 right now) - counter: pollset_kick_own_thread doc: How many times could a polling wakeup be satisfied by keeping the waking thread awake? + (only valid for epoll1 right now) # stats system - counter: histogram_slow_lookups doc: Number of times histogram increments went through the slow diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index f7f6cec9ef..8f66158369 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -789,7 +789,7 @@ static bool begin_worker(grpc_pollset *pollset, grpc_pollset_worker *worker, } static bool check_neighbourhood_for_available_poller( - pollset_neighbourhood *neighbourhood) { + grpc_exec_ctx *exec_ctx, pollset_neighbourhood *neighbourhood) { GPR_TIMER_BEGIN("check_neighbourhood_for_available_poller", 0); bool found_worker = false; do { @@ -813,6 +813,7 @@ static bool check_neighbourhood_for_available_poller( SET_KICK_STATE(inspect_worker, DESIGNATED_POLLER); if (inspect_worker->initialized_cv) { GPR_TIMER_MARK("signal worker", 0); + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); gpr_cv_signal(&inspect_worker->cv); } } else { @@ -891,7 +892,7 @@ static void end_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, g_num_neighbourhoods]; if (gpr_mu_trylock(&neighbourhood->mu)) { found_worker = - check_neighbourhood_for_available_poller(neighbourhood); + check_neighbourhood_for_available_poller(exec_ctx, neighbourhood); gpr_mu_unlock(&neighbourhood->mu); scan_state[i] = true; } else { @@ -904,7 +905,8 @@ static void end_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, &g_neighbourhoods[(poller_neighbourhood_idx + i) % g_num_neighbourhoods]; gpr_mu_lock(&neighbourhood->mu); - found_worker = check_neighbourhood_for_available_poller(neighbourhood); + found_worker = + check_neighbourhood_for_available_poller(exec_ctx, neighbourhood); gpr_mu_unlock(&neighbourhood->mu); } grpc_exec_ctx_flush(exec_ctx); -- cgit v1.2.3 From 1a012bbe8fceacfff9a2fc49528ad07de75743a2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 14:29:00 -0700 Subject: Review feedback --- src/core/lib/iomgr/ev_epoll1_linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 8f855a7b6e..aa861d3cc1 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -873,6 +873,7 @@ static void end_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, GPR_ASSERT(worker->next->initialized_cv); gpr_atm_no_barrier_store(&g_active_poller, (gpr_atm)worker->next); SET_KICK_STATE(worker->next, DESIGNATED_POLLER); + GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx); gpr_cv_signal(&worker->next->cv); if (grpc_exec_ctx_has_work(exec_ctx)) { gpr_mu_unlock(&pollset->mu); @@ -1098,7 +1099,7 @@ static grpc_error *pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, goto done; } } else { - GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx); + GRPC_STATS_INC_POLLSET_KICK_OWN_THREAD(exec_ctx); if (GRPC_TRACER_ON(grpc_polling_trace)) { gpr_log(GPR_ERROR, " .. kicked while waking up"); } -- cgit v1.2.3 From fb0262b0fda6b3f605ef8f6a65ed628f22180d54 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 15:19:19 -0700 Subject: Eliminate lock in self-scheduling path in executor --- src/core/lib/iomgr/executor.c | 57 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index 892385d7d7..edc391331f 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -38,10 +38,10 @@ typedef struct { gpr_mu mu; gpr_cv cv; grpc_closure_list elems; - size_t depth; bool shutdown; bool queued_long_job; gpr_thd_id id; + grpc_closure_list local_elems; } thread_state; static thread_state *g_thread_state; @@ -56,32 +56,30 @@ static grpc_tracer_flag executor_trace = static void executor_thread(void *arg); -static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { - size_t n = 0; - - grpc_closure *c = list.head; - while (c != NULL) { - grpc_closure *next = c->next_data.next; - grpc_error *error = c->error_data.error; - if (GRPC_TRACER_ON(executor_trace)) { +static void run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { + while (!grpc_closure_list_empty(*list)) { + grpc_closure *c = list->head; + grpc_closure_list_init(list); + while (c != NULL) { + grpc_closure *next = c->next_data.next; + grpc_error *error = c->error_data.error; + if (GRPC_TRACER_ON(executor_trace)) { #ifndef NDEBUG - gpr_log(GPR_DEBUG, "EXECUTOR: run %p [created by %s:%d]", c, - c->file_created, c->line_created); + gpr_log(GPR_DEBUG, "EXECUTOR: run %p [created by %s:%d]", c, + c->file_created, c->line_created); #else - gpr_log(GPR_DEBUG, "EXECUTOR: run %p", c); + gpr_log(GPR_DEBUG, "EXECUTOR: run %p", c); #endif - } + } #ifndef NDEBUG - c->scheduled = false; + c->scheduled = false; #endif - c->cb(exec_ctx, c->cb_arg, error); - GRPC_ERROR_UNREF(error); - c = next; - n++; - grpc_exec_ctx_flush(exec_ctx); + c->cb(exec_ctx, c->cb_arg, error); + GRPC_ERROR_UNREF(error); + c = next; + grpc_exec_ctx_flush(exec_ctx); + } } - - return n; } bool grpc_executor_is_threaded() { @@ -126,7 +124,7 @@ void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool threading) { for (size_t i = 0; i < g_max_threads; i++) { gpr_mu_destroy(&g_thread_state[i].mu); gpr_cv_destroy(&g_thread_state[i].cv); - run_closures(exec_ctx, g_thread_state[i].elems); + run_closures(exec_ctx, &g_thread_state[i].elems); } gpr_free(g_thread_state); gpr_tls_destroy(&g_this_thread_state); @@ -150,14 +148,11 @@ static void executor_thread(void *arg) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, NULL); - size_t subtract_depth = 0; for (;;) { if (GRPC_TRACER_ON(executor_trace)) { - gpr_log(GPR_DEBUG, "EXECUTOR[%d]: step (sub_depth=%" PRIdPTR ")", - (int)(ts - g_thread_state), subtract_depth); + gpr_log(GPR_DEBUG, "EXECUTOR[%d]: step", (int)(ts - g_thread_state)); } gpr_mu_lock(&ts->mu); - ts->depth -= subtract_depth; while (grpc_closure_list_empty(ts->elems) && !ts->shutdown) { ts->queued_long_job = false; gpr_cv_wait(&ts->cv, &ts->mu, gpr_inf_future(GPR_CLOCK_REALTIME)); @@ -171,14 +166,15 @@ static void executor_thread(void *arg) { break; } GRPC_STATS_INC_EXECUTOR_QUEUE_DRAINED(&exec_ctx); - grpc_closure_list exec = ts->elems; + GPR_ASSERT(grpc_closure_list_empty(ts->local_elems)); + ts->local_elems = ts->elems; ts->elems = (grpc_closure_list)GRPC_CLOSURE_LIST_INIT; gpr_mu_unlock(&ts->mu); if (GRPC_TRACER_ON(executor_trace)) { gpr_log(GPR_DEBUG, "EXECUTOR[%d]: execute", (int)(ts - g_thread_state)); } - subtract_depth = run_closures(&exec_ctx, exec); + run_closures(&exec_ctx, &ts->local_elems); } grpc_exec_ctx_finish(&exec_ctx); } @@ -211,6 +207,8 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, ts = &g_thread_state[GPR_HASH_POINTER(exec_ctx, cur_thread_count)]; } else { GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(exec_ctx); + grpc_closure_list_append(&ts->local_elems, closure, error); + return; } thread_state *orig_ts = ts; @@ -250,8 +248,7 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, gpr_cv_signal(&ts->cv); } grpc_closure_list_append(&ts->elems, closure, error); - ts->depth++; - try_new_thread = ts->depth > MAX_DEPTH && + try_new_thread = ts->elems.head != closure && cur_thread_count < g_max_threads && !ts->shutdown; if (!is_short) ts->queued_long_job = true; gpr_mu_unlock(&ts->mu); -- cgit v1.2.3 From 21b2c189d2b09b72c1afd9e5ff3cebb0b9b70a08 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 15:21:10 -0700 Subject: Remove old constant --- src/core/lib/iomgr/executor.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index edc391331f..fa8c5bfaab 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -32,8 +32,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/support/spinlock.h" -#define MAX_DEPTH 2 - typedef struct { gpr_mu mu; gpr_cv cv; -- cgit v1.2.3 From 213d2744b543cf8593838a5eb995bf9c7924c7d5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 15:22:14 -0700 Subject: Only use fast path for short items --- src/core/lib/iomgr/executor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index fa8c5bfaab..e5372c7b08 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -205,8 +205,10 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, ts = &g_thread_state[GPR_HASH_POINTER(exec_ctx, cur_thread_count)]; } else { GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(exec_ctx); - grpc_closure_list_append(&ts->local_elems, closure, error); - return; + if (!is_short) { + grpc_closure_list_append(&ts->local_elems, closure, error); + return; + } } thread_state *orig_ts = ts; -- cgit v1.2.3 From 7f10c299c7eb5d6688c20ae43c63b0548ca8acd1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 13 Sep 2017 15:26:56 -0700 Subject: Windows --- src/core/lib/iomgr/pollset_windows.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index ea017a6054..eb295d3eeb 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -98,7 +98,7 @@ void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu) { void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_closure *closure) { pollset->shutting_down = 1; - grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST); + grpc_pollset_kick(exec_ctx, pollset, GRPC_POLLSET_KICK_BROADCAST); if (!pollset->is_iocp_worker) { GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_ERROR_NONE); } else { @@ -181,7 +181,7 @@ done: return GRPC_ERROR_NONE; } -grpc_error *grpc_pollset_kick(grpc_pollset *p, +grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *p, grpc_pollset_worker *specific_worker) { if (specific_worker != NULL) { if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) { @@ -209,7 +209,7 @@ grpc_error *grpc_pollset_kick(grpc_pollset *p, specific_worker = pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); if (specific_worker != NULL) { - grpc_pollset_kick(p, specific_worker); + grpc_pollset_kick(exec_ctx, p, specific_worker); } else if (p->is_iocp_worker) { grpc_iocp_kick(); } else { -- cgit v1.2.3 From f66ed288538a7e28cdbdc694bef80bb86b696b90 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 14 Sep 2017 12:30:27 -0700 Subject: Instrument executor a little better --- src/core/lib/debug/stats_data.c | 48 ++++++++++++++++++++++++++++++++------ src/core/lib/debug/stats_data.h | 24 +++++++++++++++---- src/core/lib/debug/stats_data.yaml | 8 +++++++ src/core/lib/iomgr/executor.c | 9 +++++++ 4 files changed, 77 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/lib/debug/stats_data.c b/src/core/lib/debug/stats_data.c index 3fd8ee38ef..b52852d000 100644 --- a/src/core/lib/debug/stats_data.c +++ b/src/core/lib/debug/stats_data.c @@ -56,6 +56,8 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "executor_wakeup_initiated", "executor_queue_drained", "executor_push_retries", + "executor_threads_created", + "executor_threads_used", }; const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of client side calls created by this process", @@ -98,6 +100,8 @@ const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = { "Number of times an executor queue was drained", "Number of times we raced and were forced to retry pushing a closure to " "the executor", + "Size of the backing thread pool for overflow gRPC Core work", + "How many executor threads actually got used", }; const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { "tcp_write_size", @@ -110,6 +114,7 @@ const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { "http2_send_message_per_write", "http2_send_trailing_metadata_per_write", "http2_send_flowctl_per_write", + "executor_closures_per_wakeup", }; const char *grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT] = { "Number of bytes offered to each syscall_write", @@ -122,6 +127,7 @@ const char *grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT] = { "Number of streams whose payload was written per TCP write", "Number of streams terminated per TCP write", "Number of flow control updates written per TCP write", + "Number of closures executed each time an executor wakes up", }; const int grpc_stats_table_0[65] = { 0, 1, 2, 3, 4, 6, 8, 11, @@ -418,16 +424,43 @@ void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, grpc_stats_histo_find_bucket_slow( (exec_ctx), value, grpc_stats_table_2, 64)); } -const int grpc_stats_histo_buckets[10] = {64, 64, 64, 64, 64, +void grpc_stats_inc_executor_closures_per_wakeup(grpc_exec_ctx *exec_ctx, + int value) { + value = GPR_CLAMP(value, 0, 1024); + if (value < 13) { + GRPC_STATS_INC_HISTOGRAM( + (exec_ctx), GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP, value); + return; + } + union { + double dbl; + uint64_t uint; + } _val, _bkt; + _val.dbl = value; + if (_val.uint < 4637863191261478912ull) { + int bucket = + grpc_stats_table_3[((_val.uint - 4623507967449235456ull) >> 48)] + 13; + _bkt.dbl = grpc_stats_table_2[bucket]; + bucket -= (_val.uint < _bkt.uint); + GRPC_STATS_INC_HISTOGRAM( + (exec_ctx), GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP, bucket); + return; + } + GRPC_STATS_INC_HISTOGRAM((exec_ctx), + GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP, + grpc_stats_histo_find_bucket_slow( + (exec_ctx), value, grpc_stats_table_2, 64)); +} +const int grpc_stats_histo_buckets[11] = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}; -const int grpc_stats_histo_start[10] = {0, 64, 128, 192, 256, - 320, 384, 448, 512, 576}; -const int *const grpc_stats_histo_bucket_boundaries[10] = { +const int grpc_stats_histo_start[11] = {0, 64, 128, 192, 256, 320, + 384, 448, 512, 576, 640}; +const int *const grpc_stats_histo_bucket_boundaries[11] = { grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_0, grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_2, grpc_stats_table_2, - grpc_stats_table_2}; -void (*const grpc_stats_inc_histogram[10])(grpc_exec_ctx *exec_ctx, int x) = { + grpc_stats_table_2, grpc_stats_table_2}; +void (*const grpc_stats_inc_histogram[11])(grpc_exec_ctx *exec_ctx, int x) = { grpc_stats_inc_tcp_write_size, grpc_stats_inc_tcp_write_iov_size, grpc_stats_inc_tcp_read_size, @@ -437,4 +470,5 @@ void (*const grpc_stats_inc_histogram[10])(grpc_exec_ctx *exec_ctx, int x) = { grpc_stats_inc_http2_send_initial_metadata_per_write, grpc_stats_inc_http2_send_message_per_write, grpc_stats_inc_http2_send_trailing_metadata_per_write, - grpc_stats_inc_http2_send_flowctl_per_write}; + grpc_stats_inc_http2_send_flowctl_per_write, + grpc_stats_inc_executor_closures_per_wakeup}; diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index b7c15c08a5..cf7d3b60e2 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -58,6 +58,8 @@ typedef enum { GRPC_STATS_COUNTER_EXECUTOR_WAKEUP_INITIATED, GRPC_STATS_COUNTER_EXECUTOR_QUEUE_DRAINED, GRPC_STATS_COUNTER_EXECUTOR_PUSH_RETRIES, + GRPC_STATS_COUNTER_EXECUTOR_THREADS_CREATED, + GRPC_STATS_COUNTER_EXECUTOR_THREADS_USED, GRPC_STATS_COUNTER_COUNT } grpc_stats_counters; extern const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]; @@ -73,6 +75,7 @@ typedef enum { GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_PER_WRITE, GRPC_STATS_HISTOGRAM_HTTP2_SEND_TRAILING_METADATA_PER_WRITE, GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE, + GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP, GRPC_STATS_HISTOGRAM_COUNT } grpc_stats_histograms; extern const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT]; @@ -98,7 +101,9 @@ typedef enum { GRPC_STATS_HISTOGRAM_HTTP2_SEND_TRAILING_METADATA_PER_WRITE_BUCKETS = 64, GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE_FIRST_SLOT = 576, GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE_BUCKETS = 64, - GRPC_STATS_HISTOGRAM_BUCKETS = 640 + GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP_FIRST_SLOT = 640, + GRPC_STATS_HISTOGRAM_EXECUTOR_CLOSURES_PER_WAKEUP_BUCKETS = 64, + GRPC_STATS_HISTOGRAM_BUCKETS = 704 } 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) @@ -179,6 +184,11 @@ typedef enum { GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_QUEUE_DRAINED) #define GRPC_STATS_INC_EXECUTOR_PUSH_RETRIES(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_PUSH_RETRIES) +#define GRPC_STATS_INC_EXECUTOR_THREADS_CREATED(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), \ + GRPC_STATS_COUNTER_EXECUTOR_THREADS_CREATED) +#define GRPC_STATS_INC_EXECUTOR_THREADS_USED(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_THREADS_USED) #define GRPC_STATS_INC_TCP_WRITE_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_write_size((exec_ctx), (int)(value)) void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int x); @@ -214,10 +224,14 @@ void grpc_stats_inc_http2_send_trailing_metadata_per_write( grpc_stats_inc_http2_send_flowctl_per_write((exec_ctx), (int)(value)) void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, int x); -extern const int grpc_stats_histo_buckets[10]; -extern const int grpc_stats_histo_start[10]; -extern const int *const grpc_stats_histo_bucket_boundaries[10]; -extern void (*const grpc_stats_inc_histogram[10])(grpc_exec_ctx *exec_ctx, +#define GRPC_STATS_INC_EXECUTOR_CLOSURES_PER_WAKEUP(exec_ctx, value) \ + grpc_stats_inc_executor_closures_per_wakeup((exec_ctx), (int)(value)) +void grpc_stats_inc_executor_closures_per_wakeup(grpc_exec_ctx *exec_ctx, + int x); +extern const int grpc_stats_histo_buckets[11]; +extern const int grpc_stats_histo_start[11]; +extern const int *const grpc_stats_histo_bucket_boundaries[11]; +extern void (*const grpc_stats_inc_histogram[11])(grpc_exec_ctx *exec_ctx, int x); #endif /* GRPC_CORE_LIB_DEBUG_STATS_DATA_H */ diff --git a/src/core/lib/debug/stats_data.yaml b/src/core/lib/debug/stats_data.yaml index a9d71f4fcb..08f49d1150 100644 --- a/src/core/lib/debug/stats_data.yaml +++ b/src/core/lib/debug/stats_data.yaml @@ -135,3 +135,11 @@ - counter: executor_push_retries doc: Number of times we raced and were forced to retry pushing a closure to the executor +- counter: executor_threads_created + doc: Size of the backing thread pool for overflow gRPC Core work +- counter: executor_threads_used + doc: How many executor threads actually got used +- histogram: executor_closures_per_wakeup + max: 1024 + buckets: 64 + doc: Number of closures executed each time an executor wakes up diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index 892385d7d7..41c7ff959e 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -81,6 +81,8 @@ static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) { grpc_exec_ctx_flush(exec_ctx); } + GRPC_STATS_INC_EXECUTOR_CLOSURES_PER_WAKEUP(exec_ctx, n); + return n; } @@ -150,7 +152,10 @@ static void executor_thread(void *arg) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, NULL); + GRPC_STATS_INC_EXECUTOR_THREADS_CREATED(&exec_ctx); + size_t subtract_depth = 0; + bool used = false; for (;;) { if (GRPC_TRACER_ON(executor_trace)) { gpr_log(GPR_DEBUG, "EXECUTOR[%d]: step (sub_depth=%" PRIdPTR ")", @@ -170,6 +175,10 @@ static void executor_thread(void *arg) { gpr_mu_unlock(&ts->mu); break; } + if (!used) { + GRPC_STATS_INC_EXECUTOR_THREADS_USED(&exec_ctx); + used = true; + } GRPC_STATS_INC_EXECUTOR_QUEUE_DRAINED(&exec_ctx); grpc_closure_list exec = ts->elems; ts->elems = (grpc_closure_list)GRPC_CLOSURE_LIST_INIT; -- cgit v1.2.3 From b2b4a85c86b6e1e8f9b4e278355e77b4a4b5c682 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 14 Sep 2017 12:38:38 -0700 Subject: Correct comparison --- src/core/lib/iomgr/executor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index cf2c051c92..2439f15a8a 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -217,7 +217,7 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, ts = &g_thread_state[GPR_HASH_POINTER(exec_ctx, cur_thread_count)]; } else { GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(exec_ctx); - if (!is_short) { + if (is_short) { grpc_closure_list_append(&ts->local_elems, closure, error); return; } -- cgit v1.2.3 From 533d1184807869dfdd1cd239428be330a28a20d1 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 18 Sep 2017 10:48:22 -0700 Subject: Removing designated initializers, implicit string literal to char * conversions and solving crosses initialization due to jump warnings --- src/core/ext/filters/client_channel/http_proxy.c | 4 +- .../resolver/dns/c_ares/grpc_ares_wrapper.c | 25 ++++---- .../ext/transport/chttp2/server/chttp2_server.c | 3 +- .../transport/chttp2/transport/chttp2_transport.c | 14 ++--- .../ext/transport/chttp2/transport/hpack_encoder.c | 34 +++++------ src/core/lib/http/httpcli.c | 2 +- src/core/lib/iomgr/ev_epoll1_linux.c | 69 ++++++++++----------- src/core/lib/iomgr/ev_epollex_linux.c | 70 +++++++++++----------- src/core/lib/iomgr/ev_epollsig_linux.c | 59 +++++++++--------- src/core/lib/iomgr/ev_poll_posix.c | 56 ++++++++--------- src/core/lib/iomgr/iomgr.c | 2 +- src/core/lib/iomgr/is_epollexclusive_available.c | 12 ++-- src/core/lib/iomgr/socket_factory_posix.c | 4 +- src/core/lib/iomgr/socket_mutator.c | 4 +- src/core/lib/iomgr/tcp_server_posix.c | 4 +- src/core/lib/iomgr/timer_generic.c | 5 +- src/core/lib/surface/call.c | 31 ++++++---- src/core/lib/surface/completion_queue.c | 23 ++----- src/core/lib/transport/status_conversion.c | 2 +- src/core/lib/transport/transport.c | 8 ++- 20 files changed, 217 insertions(+), 214 deletions(-) (limited to 'src') diff --git a/src/core/ext/filters/client_channel/http_proxy.c b/src/core/ext/filters/client_channel/http_proxy.c index 0c3b009e44..c507a2750e 100644 --- a/src/core/ext/filters/client_channel/http_proxy.c +++ b/src/core/ext/filters/client_channel/http_proxy.c @@ -44,6 +44,8 @@ static char* get_http_proxy_server(grpc_exec_ctx* exec_ctx, char** user_cred) { GPR_ASSERT(user_cred != NULL); char* proxy_name = NULL; char* uri_str = gpr_getenv("http_proxy"); + char** authority_strs = NULL; + size_t authority_nstrs; if (uri_str == NULL) return NULL; grpc_uri* uri = grpc_uri_parse(exec_ctx, uri_str, false /* suppress_errors */); @@ -56,8 +58,6 @@ static char* get_http_proxy_server(grpc_exec_ctx* exec_ctx, char** user_cred) { goto done; } /* Split on '@' to separate user credentials from host */ - char** authority_strs = NULL; - size_t authority_nstrs; gpr_string_split(uri->authority, "@", &authority_strs, &authority_nstrs); GPR_ASSERT(authority_nstrs != 0); /* should have at least 1 string */ if (authority_nstrs == 1) { diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c index 0ffb38518a..9975b1ef79 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c @@ -275,14 +275,15 @@ static void on_txt_done_cb(void *arg, int status, int timeouts, gpr_log(GPR_DEBUG, "on_txt_done_cb"); char *error_msg; grpc_ares_request *r = (grpc_ares_request *)arg; + const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1; + struct ares_txt_ext *result; + struct ares_txt_ext *reply = NULL; + grpc_error *error = GRPC_ERROR_NONE; gpr_mu_lock(&r->mu); if (status != ARES_SUCCESS) goto fail; - struct ares_txt_ext *reply = NULL; status = ares_parse_txt_reply_ext(buf, len, &reply); if (status != ARES_SUCCESS) goto fail; // Find service config in TXT record. - const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1; - struct ares_txt_ext *result; for (result = reply; result != NULL; result = result->next) { if (result->record_start && memcmp(result->txt, g_service_config_attribute_prefix, prefix_len) == @@ -313,7 +314,7 @@ static void on_txt_done_cb(void *arg, int status, int timeouts, fail: gpr_asprintf(&error_msg, "C-ares TXT lookup status is not ARES_SUCCESS: %s", ares_strerror(status)); - grpc_error *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg); + error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg); gpr_free(error_msg); if (r->error == GRPC_ERROR_NONE) { r->error = error; @@ -331,6 +332,9 @@ static grpc_ares_request *grpc_dns_lookup_ares_impl( grpc_closure *on_done, grpc_lb_addresses **addrs, bool check_grpclb, char **service_config_json) { grpc_error *error = GRPC_ERROR_NONE; + grpc_ares_hostbyname_request *hr = NULL; + grpc_ares_request *r = NULL; + ares_channel *channel = NULL; /* TODO(zyc): Enable tracing after #9603 is checked in */ /* if (grpc_dns_trace) { gpr_log(GPR_DEBUG, "resolve_address (blocking): name=%s, default_port=%s", @@ -360,8 +364,7 @@ static grpc_ares_request *grpc_dns_lookup_ares_impl( error = grpc_ares_ev_driver_create(&ev_driver, interested_parties); if (error != GRPC_ERROR_NONE) goto error_cleanup; - grpc_ares_request *r = - (grpc_ares_request *)gpr_zalloc(sizeof(grpc_ares_request)); + r = (grpc_ares_request *)gpr_zalloc(sizeof(grpc_ares_request)); gpr_mu_init(&r->mu); r->ev_driver = ev_driver; r->on_done = on_done; @@ -369,7 +372,7 @@ static grpc_ares_request *grpc_dns_lookup_ares_impl( r->service_config_json_out = service_config_json; r->success = false; r->error = GRPC_ERROR_NONE; - ares_channel *channel = grpc_ares_ev_driver_get_channel(r->ev_driver); + channel = grpc_ares_ev_driver_get_channel(r->ev_driver); // If dns_server is specified, use it. if (dns_server != NULL) { @@ -410,12 +413,12 @@ static grpc_ares_request *grpc_dns_lookup_ares_impl( } gpr_ref_init(&r->pending_queries, 1); if (grpc_ipv6_loopback_available()) { - grpc_ares_hostbyname_request *hr = create_hostbyname_request( - r, host, strhtons(port), false /* is_balancer */); + hr = create_hostbyname_request(r, host, strhtons(port), + false /* is_balancer */); ares_gethostbyname(*channel, hr->host, AF_INET6, on_hostbyname_done_cb, hr); } - grpc_ares_hostbyname_request *hr = create_hostbyname_request( - r, host, strhtons(port), false /* is_balancer */); + hr = create_hostbyname_request(r, host, strhtons(port), + false /* is_balancer */); ares_gethostbyname(*channel, hr->host, AF_INET, on_hostbyname_done_cb, hr); if (check_grpclb) { /* Query the SRV record */ diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c index f5a409a403..60244e163b 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.c +++ b/src/core/ext/transport/chttp2/server/chttp2_server.c @@ -201,6 +201,7 @@ grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx, grpc_error *err = GRPC_ERROR_NONE; server_state *state = NULL; grpc_error **errors = NULL; + size_t naddrs = 0; *port_num = -1; @@ -225,7 +226,7 @@ grpc_error *grpc_chttp2_server_add_port(grpc_exec_ctx *exec_ctx, state->shutdown = true; gpr_mu_init(&state->mu); - const size_t naddrs = resolved->naddrs; + naddrs = resolved->naddrs; errors = (grpc_error **)gpr_malloc(sizeof(*errors) * naddrs); for (i = 0; i < naddrs; i++) { errors[i] = diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 79a9ed827f..d18df04851 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -362,14 +362,12 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); - t->ping_policy = (grpc_chttp2_repeated_ping_policy){ - .max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA, - .min_time_between_pings = - gpr_time_from_millis(DEFAULT_MIN_TIME_BETWEEN_PINGS_MS, GPR_TIMESPAN), - .max_ping_strikes = DEFAULT_MAX_PING_STRIKES, - .min_ping_interval_without_data = gpr_time_from_millis( - DEFAULT_MIN_PING_INTERVAL_WITHOUT_DATA_MS, GPR_TIMESPAN), - }; + t->ping_policy.max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA; + t->ping_policy.min_time_between_pings = + gpr_time_from_millis(DEFAULT_MIN_TIME_BETWEEN_PINGS_MS, GPR_TIMESPAN); + t->ping_policy.max_ping_strikes = DEFAULT_MAX_PING_STRIKES; + t->ping_policy.min_ping_interval_without_data = gpr_time_from_millis( + DEFAULT_MIN_PING_INTERVAL_WITHOUT_DATA_MS, GPR_TIMESPAN); /* Keepalive setting */ if (t->is_client) { diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 3cd1a7ee5c..9537c2fa17 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -51,8 +51,9 @@ #define MAX_DECODER_SPACE_USAGE 512 static grpc_slice_refcount terminal_slice_refcount = {NULL, NULL}; -static const grpc_slice terminal_slice = {&terminal_slice_refcount, - .data.refcounted = {0, 0}}; +static const grpc_slice terminal_slice = {&terminal_slice_refcount, /* refcount */ + {{0, 0}} /* refcounted */ +}; extern grpc_tracer_flag grpc_http_trace; @@ -283,29 +284,26 @@ typedef struct { } wire_value; static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) { + wire_value wire_val; if (grpc_is_binary_header(GRPC_MDKEY(elem))) { if (true_binary_enabled) { - return (wire_value){ - .huffman_prefix = 0x00, - .insert_null_before_wire_value = true, - .data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)), - }; + wire_val.huffman_prefix = 0x00; + wire_val.insert_null_before_wire_value = true; + wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)); + } else { - return (wire_value){ - .huffman_prefix = 0x80, - .insert_null_before_wire_value = false, - .data = grpc_chttp2_base64_encode_and_huffman_compress( - GRPC_MDVALUE(elem)), - }; + wire_val.huffman_prefix = 0x80; + wire_val.insert_null_before_wire_value = false; + wire_val.data = + grpc_chttp2_base64_encode_and_huffman_compress(GRPC_MDVALUE(elem)); } } else { /* TODO(ctiller): opportunistically compress non-binary headers */ - return (wire_value){ - .huffman_prefix = 0x00, - .insert_null_before_wire_value = false, - .data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)), - }; + wire_val.huffman_prefix = 0x00; + wire_val.insert_null_before_wire_value = false; + wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)); } + return wire_val; } static size_t wire_value_length(wire_value v) { diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index 84cc39604c..db995943a9 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -217,7 +217,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req, GRPC_CLOSURE_INIT(&req->connected, on_connected, req, grpc_schedule_on_exec_ctx); grpc_arg arg = grpc_channel_arg_pointer_create( - GRPC_ARG_RESOURCE_QUOTA, req->resource_quota, + (char *)GRPC_ARG_RESOURCE_QUOTA, req->resource_quota, grpc_resource_quota_arg_vtable()); grpc_channel_args args = {1, &arg}; grpc_tcp_client_connect(exec_ctx, &req->connected, &req->ep, diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 0d57833d85..b5066e5f58 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -280,8 +280,9 @@ static grpc_fd *fd_create(int fd, const char *name) { #endif gpr_free(fd_name); - struct epoll_event ev = {.events = (uint32_t)(EPOLLIN | EPOLLOUT | EPOLLET), - .data.ptr = new_fd}; + struct epoll_event ev; + ev.events = (uint32_t)(EPOLLIN | EPOLLOUT | EPOLLET); + ev.data.ptr = new_fd; if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) { gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno)); } @@ -435,8 +436,9 @@ static grpc_error *pollset_global_init(void) { global_wakeup_fd.read_fd = -1; grpc_error *err = grpc_wakeup_fd_init(&global_wakeup_fd); if (err != GRPC_ERROR_NONE) return err; - struct epoll_event ev = {.events = (uint32_t)(EPOLLIN | EPOLLET), - .data.ptr = &global_wakeup_fd}; + struct epoll_event ev; + ev.events = (uint32_t)(EPOLLIN | EPOLLET); + ev.data.ptr = &global_wakeup_fd; if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, global_wakeup_fd.read_fd, &ev) != 0) { return GRPC_OS_ERROR(errno, "epoll_ctl"); @@ -566,8 +568,7 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, return 0; } - static const gpr_timespec round_up = { - .clock_type = GPR_TIMESPAN, .tv_sec = 0, .tv_nsec = GPR_NS_PER_MS - 1}; + static const gpr_timespec round_up = {0, GPR_NS_PER_MS - 1, GPR_TIMESPAN}; timeout = gpr_time_sub(deadline, now); int millis = gpr_time_to_millis(gpr_time_add(timeout, round_up)); return millis >= 1 ? millis : 1; @@ -1172,34 +1173,34 @@ static void shutdown_engine(void) { } static const grpc_event_engine_vtable vtable = { - .pollset_size = sizeof(grpc_pollset), - - .fd_create = fd_create, - .fd_wrapped_fd = fd_wrapped_fd, - .fd_orphan = fd_orphan, - .fd_shutdown = fd_shutdown, - .fd_is_shutdown = fd_is_shutdown, - .fd_notify_on_read = fd_notify_on_read, - .fd_notify_on_write = fd_notify_on_write, - .fd_get_read_notifier_pollset = fd_get_read_notifier_pollset, - - .pollset_init = pollset_init, - .pollset_shutdown = pollset_shutdown, - .pollset_destroy = pollset_destroy, - .pollset_work = pollset_work, - .pollset_kick = pollset_kick, - .pollset_add_fd = pollset_add_fd, - - .pollset_set_create = pollset_set_create, - .pollset_set_destroy = pollset_set_destroy, - .pollset_set_add_pollset = pollset_set_add_pollset, - .pollset_set_del_pollset = pollset_set_del_pollset, - .pollset_set_add_pollset_set = pollset_set_add_pollset_set, - .pollset_set_del_pollset_set = pollset_set_del_pollset_set, - .pollset_set_add_fd = pollset_set_add_fd, - .pollset_set_del_fd = pollset_set_del_fd, - - .shutdown_engine = shutdown_engine, + sizeof(grpc_pollset), + + fd_create, + fd_wrapped_fd, + fd_orphan, + fd_shutdown, + fd_notify_on_read, + fd_notify_on_write, + fd_is_shutdown, + fd_get_read_notifier_pollset, + + pollset_init, + pollset_shutdown, + pollset_destroy, + pollset_work, + pollset_kick, + pollset_add_fd, + + pollset_set_create, + pollset_set_destroy, + pollset_set_add_pollset, + pollset_set_del_pollset, + pollset_set_add_pollset_set, + pollset_set_del_pollset_set, + pollset_set_add_fd, + pollset_set_del_fd, + + shutdown_engine, }; /* It is possible that GLIBC has epoll but the underlying kernel doesn't. diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index 51200fc064..671c4cd730 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -477,8 +477,9 @@ static grpc_error *pollable_materialize(pollable *p) { close(new_epfd); return err; } - struct epoll_event ev = {.events = (uint32_t)(EPOLLIN | EPOLLET), - .data.ptr = (void *)(1 | (intptr_t)&p->wakeup)}; + struct epoll_event ev; + ev.events = (uint32_t)(EPOLLIN | EPOLLET); + ev.data.ptr = (void *)(1 | (intptr_t)&p->wakeup); if (epoll_ctl(new_epfd, EPOLL_CTL_ADD, p->wakeup.read_fd, &ev) != 0) { err = GRPC_OS_ERROR(errno, "epoll_ctl"); close(new_epfd); @@ -507,9 +508,9 @@ static grpc_error *pollable_add_fd(pollable *p, grpc_fd *fd) { gpr_mu_unlock(&fd->orphaned_mu); return GRPC_ERROR_NONE; } - struct epoll_event ev_fd = { - .events = (uint32_t)(EPOLLET | EPOLLIN | EPOLLOUT | EPOLLEXCLUSIVE), - .data.ptr = fd}; + struct epoll_event ev_fd; + ev_fd.events = (uint32_t)(EPOLLET | EPOLLIN | EPOLLOUT | EPOLLEXCLUSIVE); + ev_fd.data.ptr = fd; if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd->fd, &ev_fd) != 0) { switch (errno) { case EEXIST: @@ -705,8 +706,7 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, return 0; } - static const gpr_timespec round_up = { - .clock_type = GPR_TIMESPAN, .tv_sec = 0, .tv_nsec = GPR_NS_PER_MS - 1}; + static const gpr_timespec round_up = {0, GPR_NS_PER_MS - 1, GPR_TIMESPAN}; timeout = gpr_time_sub(deadline, now); int millis = gpr_time_to_millis(gpr_time_add(timeout, round_up)); return millis >= 1 ? millis : 1; @@ -1390,34 +1390,34 @@ static void shutdown_engine(void) { } static const grpc_event_engine_vtable vtable = { - .pollset_size = sizeof(grpc_pollset), - - .fd_create = fd_create, - .fd_wrapped_fd = fd_wrapped_fd, - .fd_orphan = fd_orphan, - .fd_shutdown = fd_shutdown, - .fd_is_shutdown = fd_is_shutdown, - .fd_notify_on_read = fd_notify_on_read, - .fd_notify_on_write = fd_notify_on_write, - .fd_get_read_notifier_pollset = fd_get_read_notifier_pollset, - - .pollset_init = pollset_init, - .pollset_shutdown = pollset_shutdown, - .pollset_destroy = pollset_destroy, - .pollset_work = pollset_work, - .pollset_kick = pollset_kick, - .pollset_add_fd = pollset_add_fd, - - .pollset_set_create = pollset_set_create, - .pollset_set_destroy = pollset_set_destroy, - .pollset_set_add_pollset = pollset_set_add_pollset, - .pollset_set_del_pollset = pollset_set_del_pollset, - .pollset_set_add_pollset_set = pollset_set_add_pollset_set, - .pollset_set_del_pollset_set = pollset_set_del_pollset_set, - .pollset_set_add_fd = pollset_set_add_fd, - .pollset_set_del_fd = pollset_set_del_fd, - - .shutdown_engine = shutdown_engine, + sizeof(grpc_pollset), + + fd_create, + fd_wrapped_fd, + fd_orphan, + fd_shutdown, + fd_notify_on_read, + fd_notify_on_write, + fd_is_shutdown, + fd_get_read_notifier_pollset, + + pollset_init, + pollset_shutdown, + pollset_destroy, + pollset_work, + pollset_kick, + pollset_add_fd, + + pollset_set_create, + pollset_set_destroy, + pollset_set_add_pollset, + pollset_set_del_pollset, + pollset_set_add_pollset_set, + pollset_set_del_pollset_set, + pollset_set_add_fd, + pollset_set_del_fd, + + shutdown_engine, }; const grpc_event_engine_vtable *grpc_init_epollex_linux( diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index b88c3ba111..87b6f363f8 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -1132,7 +1132,8 @@ static void fd_become_writable(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { } static void pollset_release_polling_island(grpc_exec_ctx *exec_ctx, - grpc_pollset *ps, char *reason) { + grpc_pollset *ps, + const char *reason) { if (ps->po.pi != NULL) { PI_UNREF(exec_ctx, ps->po.pi, reason); } @@ -1670,34 +1671,34 @@ static void shutdown_engine(void) { } static const grpc_event_engine_vtable vtable = { - .pollset_size = sizeof(grpc_pollset), - - .fd_create = fd_create, - .fd_wrapped_fd = fd_wrapped_fd, - .fd_orphan = fd_orphan, - .fd_shutdown = fd_shutdown, - .fd_is_shutdown = fd_is_shutdown, - .fd_notify_on_read = fd_notify_on_read, - .fd_notify_on_write = fd_notify_on_write, - .fd_get_read_notifier_pollset = fd_get_read_notifier_pollset, - - .pollset_init = pollset_init, - .pollset_shutdown = pollset_shutdown, - .pollset_destroy = pollset_destroy, - .pollset_work = pollset_work, - .pollset_kick = pollset_kick, - .pollset_add_fd = pollset_add_fd, - - .pollset_set_create = pollset_set_create, - .pollset_set_destroy = pollset_set_destroy, - .pollset_set_add_pollset = pollset_set_add_pollset, - .pollset_set_del_pollset = pollset_set_del_pollset, - .pollset_set_add_pollset_set = pollset_set_add_pollset_set, - .pollset_set_del_pollset_set = pollset_set_del_pollset_set, - .pollset_set_add_fd = pollset_set_add_fd, - .pollset_set_del_fd = pollset_set_del_fd, - - .shutdown_engine = shutdown_engine, + sizeof(grpc_pollset), + + fd_create, + fd_wrapped_fd, + fd_orphan, + fd_shutdown, + fd_notify_on_read, + fd_notify_on_write, + fd_is_shutdown, + fd_get_read_notifier_pollset, + + pollset_init, + pollset_shutdown, + pollset_destroy, + pollset_work, + pollset_kick, + pollset_add_fd, + + pollset_set_create, + pollset_set_destroy, + pollset_set_add_pollset, + pollset_set_del_pollset, + pollset_set_add_pollset_set, + pollset_set_del_pollset_set, + pollset_set_add_fd, + pollset_set_del_fd, + + shutdown_engine, }; /* It is possible that GLIBC has epoll but the underlying kernel doesn't. diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 7f44eda138..53df2d7737 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -1688,34 +1688,34 @@ static void shutdown_engine(void) { } static const grpc_event_engine_vtable vtable = { - .pollset_size = sizeof(grpc_pollset), - - .fd_create = fd_create, - .fd_wrapped_fd = fd_wrapped_fd, - .fd_orphan = fd_orphan, - .fd_shutdown = fd_shutdown, - .fd_is_shutdown = fd_is_shutdown, - .fd_notify_on_read = fd_notify_on_read, - .fd_notify_on_write = fd_notify_on_write, - .fd_get_read_notifier_pollset = fd_get_read_notifier_pollset, - - .pollset_init = pollset_init, - .pollset_shutdown = pollset_shutdown, - .pollset_destroy = pollset_destroy, - .pollset_work = pollset_work, - .pollset_kick = pollset_kick, - .pollset_add_fd = pollset_add_fd, - - .pollset_set_create = pollset_set_create, - .pollset_set_destroy = pollset_set_destroy, - .pollset_set_add_pollset = pollset_set_add_pollset, - .pollset_set_del_pollset = pollset_set_del_pollset, - .pollset_set_add_pollset_set = pollset_set_add_pollset_set, - .pollset_set_del_pollset_set = pollset_set_del_pollset_set, - .pollset_set_add_fd = pollset_set_add_fd, - .pollset_set_del_fd = pollset_set_del_fd, - - .shutdown_engine = shutdown_engine, + sizeof(grpc_pollset), + + fd_create, + fd_wrapped_fd, + fd_orphan, + fd_shutdown, + fd_notify_on_read, + fd_notify_on_write, + fd_is_shutdown, + fd_get_read_notifier_pollset, + + pollset_init, + pollset_shutdown, + pollset_destroy, + pollset_work, + pollset_kick, + pollset_add_fd, + + pollset_set_create, + pollset_set_destroy, + pollset_set_add_pollset, + pollset_set_del_pollset, + pollset_set_add_pollset_set, + pollset_set_del_pollset_set, + pollset_set_add_fd, + pollset_set_del_fd, + + shutdown_engine, }; const grpc_event_engine_vtable *grpc_init_poll_posix(bool explicit_request) { diff --git a/src/core/lib/iomgr/iomgr.c b/src/core/lib/iomgr/iomgr.c index 1feea6d628..f63f190155 100644 --- a/src/core/lib/iomgr/iomgr.c +++ b/src/core/lib/iomgr/iomgr.c @@ -50,7 +50,7 @@ void grpc_iomgr_init(grpc_exec_ctx *exec_ctx) { grpc_executor_init(exec_ctx); grpc_timer_list_init(gpr_now(GPR_CLOCK_MONOTONIC)); g_root_object.next = g_root_object.prev = &g_root_object; - g_root_object.name = "root"; + g_root_object.name = (char *)"root"; grpc_network_status_init(); grpc_iomgr_platform_init(); } diff --git a/src/core/lib/iomgr/is_epollexclusive_available.c b/src/core/lib/iomgr/is_epollexclusive_available.c index e8a7d4d52c..d08844c0df 100644 --- a/src/core/lib/iomgr/is_epollexclusive_available.c +++ b/src/core/lib/iomgr/is_epollexclusive_available.c @@ -57,12 +57,12 @@ bool grpc_is_epollexclusive_available(void) { close(fd); return false; } - struct epoll_event ev = { - /* choose events that should cause an error on - EPOLLEXCLUSIVE enabled kernels - specifically the combination of - EPOLLONESHOT and EPOLLEXCLUSIVE */ - .events = (uint32_t)(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE | EPOLLONESHOT), - .data.ptr = NULL}; + struct epoll_event ev; + /* choose events that should cause an error on + EPOLLEXCLUSIVE enabled kernels - specifically the combination of + EPOLLONESHOT and EPOLLEXCLUSIVE */ + ev.events = (uint32_t)(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE | EPOLLONESHOT); + ev.data.ptr = NULL; if (epoll_ctl(fd, EPOLL_CTL_ADD, evfd, &ev) != 0) { if (errno != EINVAL) { if (!logged_why_not) { diff --git a/src/core/lib/iomgr/socket_factory_posix.c b/src/core/lib/iomgr/socket_factory_posix.c index c81566575e..8e907703ae 100644 --- a/src/core/lib/iomgr/socket_factory_posix.c +++ b/src/core/lib/iomgr/socket_factory_posix.c @@ -85,8 +85,8 @@ static const grpc_arg_pointer_vtable socket_factory_arg_vtable = { socket_factory_arg_copy, socket_factory_arg_destroy, socket_factory_cmp}; grpc_arg grpc_socket_factory_to_arg(grpc_socket_factory *factory) { - return grpc_channel_arg_pointer_create(GRPC_ARG_SOCKET_FACTORY, factory, - &socket_factory_arg_vtable); + return grpc_channel_arg_pointer_create((char *)GRPC_ARG_SOCKET_FACTORY, + factory, &socket_factory_arg_vtable); } #endif diff --git a/src/core/lib/iomgr/socket_mutator.c b/src/core/lib/iomgr/socket_mutator.c index 300ac75b38..b0435d5a07 100644 --- a/src/core/lib/iomgr/socket_mutator.c +++ b/src/core/lib/iomgr/socket_mutator.c @@ -76,6 +76,6 @@ static const grpc_arg_pointer_vtable socket_mutator_arg_vtable = { socket_mutator_arg_copy, socket_mutator_arg_destroy, socket_mutator_cmp}; grpc_arg grpc_socket_mutator_to_arg(grpc_socket_mutator *mutator) { - return grpc_channel_arg_pointer_create(GRPC_ARG_SOCKET_MUTATOR, mutator, - &socket_mutator_arg_vtable); + return grpc_channel_arg_pointer_create((char *)GRPC_ARG_SOCKET_MUTATOR, + mutator, &socket_mutator_arg_vtable); } diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c index c3ec3e447a..06612d639c 100644 --- a/src/core/lib/iomgr/tcp_server_posix.c +++ b/src/core/lib/iomgr/tcp_server_posix.c @@ -198,12 +198,12 @@ static void tcp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { /* event manager callback when reads are ready */ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *err) { grpc_tcp_listener *sp = (grpc_tcp_listener *)arg; - + grpc_pollset *read_notifier_pollset; if (err != GRPC_ERROR_NONE) { goto error; } - grpc_pollset *read_notifier_pollset = + read_notifier_pollset = sp->server->pollsets[(size_t)gpr_atm_no_barrier_fetch_add( &sp->server->next_pollset_to_assign, 1) % sp->server->pollset_count]; diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index c08bb525b7..c5955c869c 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -96,7 +96,10 @@ struct shared_mutables { } GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE); static struct shared_mutables g_shared_mutables = { - .checker_mu = GPR_SPINLOCK_STATIC_INITIALIZER, .initialized = false, + 0, + GPR_SPINLOCK_STATIC_INITIALIZER, + false, + {{0}} }; static gpr_clock_type g_clock_type; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index a41eb336d4..09b107cf6b 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1673,6 +1673,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, batch_control *bctl; int num_completion_callbacks_needed = 1; grpc_call_error error = GRPC_CALL_OK; + grpc_transport_stream_op_batch *stream_op; + grpc_transport_stream_op_batch_payload *stream_op_payload; GPR_TIMER_BEGIN("grpc_call_start_batch", 0); GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag); @@ -1699,9 +1701,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, bctl->completion_data.notify_tag.is_closure = (uint8_t)(is_notify_tag_closure != 0); - grpc_transport_stream_op_batch *stream_op = &bctl->op; - grpc_transport_stream_op_batch_payload *stream_op_payload = - &call->stream_op_payload; + stream_op = &bctl->op; + stream_op_payload = &call->stream_op_payload; /* rewrite batch ops into a transport op */ for (i = 0; i < nops; i++) { @@ -1711,7 +1712,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, goto done_with_error; } switch (op->op) { - case GRPC_OP_SEND_INITIAL_METADATA: + case GRPC_OP_SEND_INITIAL_METADATA: { /* Flag validation: currently allow no flags */ if (!are_initial_metadata_flags_valid(op->flags, call->is_client)) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1805,7 +1806,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, &call->peer_string; } break; - case GRPC_OP_SEND_MESSAGE: + } + case GRPC_OP_SEND_MESSAGE: { if (!are_write_flags_valid(op->flags)) { error = GRPC_CALL_ERROR_INVALID_FLAGS; goto done_with_error; @@ -1834,7 +1836,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op_payload->send_message.send_message = &call->sending_stream.base; break; - case GRPC_OP_SEND_CLOSE_FROM_CLIENT: + } + case GRPC_OP_SEND_CLOSE_FROM_CLIENT: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1853,7 +1856,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op_payload->send_trailing_metadata.send_trailing_metadata = &call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */]; break; - case GRPC_OP_SEND_STATUS_FROM_SERVER: + } + case GRPC_OP_SEND_STATUS_FROM_SERVER: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1915,7 +1919,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op_payload->send_trailing_metadata.send_trailing_metadata = &call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */]; break; - case GRPC_OP_RECV_INITIAL_METADATA: + } + case GRPC_OP_RECV_INITIAL_METADATA: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1942,7 +1947,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, } num_completion_callbacks_needed++; break; - case GRPC_OP_RECV_MESSAGE: + } + case GRPC_OP_RECV_MESSAGE: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1963,7 +1969,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, &call->receiving_stream_ready; num_completion_callbacks_needed++; break; - case GRPC_OP_RECV_STATUS_ON_CLIENT: + } + case GRPC_OP_RECV_STATUS_ON_CLIENT: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -1990,7 +1997,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op_payload->collect_stats.collect_stats = &call->final_info.stats.transport_stream_stats; break; - case GRPC_OP_RECV_CLOSE_ON_SERVER: + } + case GRPC_OP_RECV_CLOSE_ON_SERVER: { /* Flag validation: currently allow no flags */ if (op->flags != 0) { error = GRPC_CALL_ERROR_INVALID_FLAGS; @@ -2014,6 +2022,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, stream_op_payload->collect_stats.collect_stats = &call->final_info.stats.transport_stream_stats; break; + } } } diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 468360fbde..d60a0cd451 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -328,25 +328,12 @@ static void cq_destroy_pluck(void *data); /* Completion queue vtables based on the completion-type */ static const cq_vtable g_cq_vtable[] = { /* GRPC_CQ_NEXT */ - {.data_size = sizeof(cq_next_data), - .cq_completion_type = GRPC_CQ_NEXT, - .init = cq_init_next, - .shutdown = cq_shutdown_next, - .destroy = cq_destroy_next, - .begin_op = cq_begin_op_for_next, - .end_op = cq_end_op_for_next, - .next = cq_next, - .pluck = NULL}, + {GRPC_CQ_NEXT, sizeof(cq_next_data), cq_init_next, cq_shutdown_next, + cq_destroy_next, cq_begin_op_for_next, cq_end_op_for_next, cq_next, NULL}, /* GRPC_CQ_PLUCK */ - {.data_size = sizeof(cq_pluck_data), - .cq_completion_type = GRPC_CQ_PLUCK, - .init = cq_init_pluck, - .shutdown = cq_shutdown_pluck, - .destroy = cq_destroy_pluck, - .begin_op = cq_begin_op_for_pluck, - .end_op = cq_end_op_for_pluck, - .next = NULL, - .pluck = cq_pluck}, + {GRPC_CQ_PLUCK, sizeof(cq_pluck_data), cq_init_pluck, cq_shutdown_pluck, + cq_destroy_pluck, cq_begin_op_for_pluck, cq_end_op_for_pluck, NULL, + cq_pluck}, }; #define DATA_FROM_CQ(cq) ((void *)(cq + 1)) diff --git a/src/core/lib/transport/status_conversion.c b/src/core/lib/transport/status_conversion.c index 9a76977e4b..a40d333284 100644 --- a/src/core/lib/transport/status_conversion.c +++ b/src/core/lib/transport/status_conversion.c @@ -18,7 +18,7 @@ #include "src/core/lib/transport/status_conversion.h" -int grpc_status_to_http2_error(grpc_status_code status) { +grpc_http2_error_code grpc_status_to_http2_error(grpc_status_code status) { switch (status) { case GRPC_STATUS_OK: return GRPC_HTTP2_NO_ERROR; diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index ae705195f3..682a820b48 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -102,9 +102,11 @@ static void slice_stream_unref(grpc_exec_ctx *exec_ctx, void *p) { grpc_slice grpc_slice_from_stream_owned_buffer(grpc_stream_refcount *refcount, void *buffer, size_t length) { slice_stream_ref(&refcount->slice_refcount); - return (grpc_slice){ - .refcount = &refcount->slice_refcount, - .data.refcounted = {.bytes = (uint8_t *)buffer, .length = length}}; + grpc_slice res; + res.refcount = &refcount->slice_refcount, + res.data.refcounted.bytes = (uint8_t *)buffer; + res.data.refcounted.length = length; + return res; } static const grpc_slice_refcount_vtable stream_ref_slice_vtable = { -- cgit v1.2.3 From 067611f19214af4a44435016234b65fc3918bbed Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 18 Sep 2017 12:57:42 -0700 Subject: static metadata and clang format --- .../ext/transport/chttp2/transport/hpack_encoder.c | 5 +- src/core/lib/iomgr/timer_generic.c | 6 +- src/core/lib/transport/static_metadata.c | 816 +++++++-------------- tools/codegen/core/gen_static_metadata.py | 4 +- 4 files changed, 278 insertions(+), 553 deletions(-) (limited to 'src') diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 9537c2fa17..52c9e217f1 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -51,8 +51,9 @@ #define MAX_DECODER_SPACE_USAGE 512 static grpc_slice_refcount terminal_slice_refcount = {NULL, NULL}; -static const grpc_slice terminal_slice = {&terminal_slice_refcount, /* refcount */ - {{0, 0}} /* refcounted */ +static const grpc_slice terminal_slice = { + &terminal_slice_refcount, /* refcount */ + {{0, 0}} /* refcounted */ }; extern grpc_tracer_flag grpc_http_trace; diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index c5955c869c..57b63cb229 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -96,11 +96,7 @@ struct shared_mutables { } GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE); static struct shared_mutables g_shared_mutables = { - 0, - GPR_SPINLOCK_STATIC_INITIALIZER, - false, - {{0}} -}; + 0, GPR_SPINLOCK_STATIC_INITIALIZER, false, {{0}}}; static gpr_clock_type g_clock_type; static gpr_timespec g_start_time; diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c index b20d94aeac..472cf888ea 100644 --- a/src/core/lib/transport/static_metadata.c +++ b/src/core/lib/transport/static_metadata.c @@ -216,206 +216,106 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { - {.refcount = &grpc_static_metadata_refcounts[0], - .data.refcounted = {g_bytes + 0, 5}}, - {.refcount = &grpc_static_metadata_refcounts[1], - .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[3], - .data.refcounted = {g_bytes + 19, 10}}, - {.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, - {.refcount = &grpc_static_metadata_refcounts[5], - .data.refcounted = {g_bytes + 36, 2}}, - {.refcount = &grpc_static_metadata_refcounts[6], - .data.refcounted = {g_bytes + 38, 12}}, - {.refcount = &grpc_static_metadata_refcounts[7], - .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[8], - .data.refcounted = {g_bytes + 61, 16}}, - {.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, - {.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[11], - .data.refcounted = {g_bytes + 110, 21}}, - {.refcount = &grpc_static_metadata_refcounts[12], - .data.refcounted = {g_bytes + 131, 13}}, - {.refcount = &grpc_static_metadata_refcounts[13], - .data.refcounted = {g_bytes + 144, 14}}, - {.refcount = &grpc_static_metadata_refcounts[14], - .data.refcounted = {g_bytes + 158, 12}}, - {.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 170, 16}}, - {.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[17], - .data.refcounted = {g_bytes + 201, 30}}, - {.refcount = &grpc_static_metadata_refcounts[18], - .data.refcounted = {g_bytes + 231, 37}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 268, 10}}, - {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 278, 4}}, - {.refcount = &grpc_static_metadata_refcounts[21], - .data.refcounted = {g_bytes + 282, 8}}, - {.refcount = &grpc_static_metadata_refcounts[22], - .data.refcounted = {g_bytes + 290, 12}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}, - {.refcount = &grpc_static_metadata_refcounts[24], - .data.refcounted = {g_bytes + 302, 19}}, - {.refcount = &grpc_static_metadata_refcounts[25], - .data.refcounted = {g_bytes + 321, 12}}, - {.refcount = &grpc_static_metadata_refcounts[26], - .data.refcounted = {g_bytes + 333, 30}}, - {.refcount = &grpc_static_metadata_refcounts[27], - .data.refcounted = {g_bytes + 363, 31}}, - {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 394, 36}}, - {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 430, 1}}, - {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 431, 1}}, - {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 432, 1}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 433, 8}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 441, 4}}, - {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 445, 7}}, - {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 452, 8}}, - {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 460, 16}}, - {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 476, 4}}, - {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 480, 3}}, - {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 483, 3}}, - {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 486, 4}}, - {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 490, 5}}, - {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 495, 4}}, - {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 499, 3}}, - {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 502, 3}}, - {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 505, 1}}, - {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 506, 11}}, - {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 517, 3}}, - {.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 520, 3}}, - {.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 523, 3}}, - {.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 526, 3}}, - {.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 529, 3}}, - {.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 532, 14}}, - {.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 546, 13}}, - {.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 559, 15}}, - {.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 574, 13}}, - {.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 587, 6}}, - {.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 593, 27}}, - {.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 620, 3}}, - {.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 623, 5}}, - {.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 628, 13}}, - {.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 641, 13}}, - {.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 654, 19}}, - {.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 673, 16}}, - {.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 689, 14}}, - {.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 703, 16}}, - {.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 719, 13}}, - {.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 732, 6}}, - {.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 738, 4}}, - {.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 742, 4}}, - {.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 746, 6}}, - {.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 752, 7}}, - {.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 759, 4}}, - {.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 763, 8}}, - {.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 771, 17}}, - {.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 788, 13}}, - {.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 801, 8}}, - {.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 809, 19}}, - {.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 828, 13}}, - {.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 841, 11}}, - {.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 852, 4}}, - {.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 856, 8}}, - {.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 864, 12}}, - {.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 876, 18}}, - {.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 894, 19}}, - {.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 913, 5}}, - {.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 918, 7}}, - {.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 925, 7}}, - {.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 932, 11}}, - {.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 943, 6}}, - {.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 949, 10}}, - {.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 959, 25}}, - {.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 984, 17}}, - {.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 1001, 4}}, - {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 1005, 3}}, - {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 1008, 16}}, - {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 1024, 16}}, - {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1040, 13}}, - {.refcount = &grpc_static_metadata_refcounts[98], - .data.refcounted = {g_bytes + 1053, 12}}, - {.refcount = &grpc_static_metadata_refcounts[99], - .data.refcounted = {g_bytes + 1065, 21}}, + {&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}}, + {&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, + {&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[3], {{g_bytes + 19, 10}}}, + {&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, + {&grpc_static_metadata_refcounts[5], {{g_bytes + 36, 2}}}, + {&grpc_static_metadata_refcounts[6], {{g_bytes + 38, 12}}}, + {&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, + {&grpc_static_metadata_refcounts[8], {{g_bytes + 61, 16}}}, + {&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, + {&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[11], {{g_bytes + 110, 21}}}, + {&grpc_static_metadata_refcounts[12], {{g_bytes + 131, 13}}}, + {&grpc_static_metadata_refcounts[13], {{g_bytes + 144, 14}}}, + {&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}}, + {&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, + {&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[17], {{g_bytes + 201, 30}}}, + {&grpc_static_metadata_refcounts[18], {{g_bytes + 231, 37}}}, + {&grpc_static_metadata_refcounts[19], {{g_bytes + 268, 10}}}, + {&grpc_static_metadata_refcounts[20], {{g_bytes + 278, 4}}}, + {&grpc_static_metadata_refcounts[21], {{g_bytes + 282, 8}}}, + {&grpc_static_metadata_refcounts[22], {{g_bytes + 290, 12}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}, + {&grpc_static_metadata_refcounts[24], {{g_bytes + 302, 19}}}, + {&grpc_static_metadata_refcounts[25], {{g_bytes + 321, 12}}}, + {&grpc_static_metadata_refcounts[26], {{g_bytes + 333, 30}}}, + {&grpc_static_metadata_refcounts[27], {{g_bytes + 363, 31}}}, + {&grpc_static_metadata_refcounts[28], {{g_bytes + 394, 36}}}, + {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 1}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 431, 1}}}, + {&grpc_static_metadata_refcounts[31], {{g_bytes + 432, 1}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 433, 8}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 441, 4}}}, + {&grpc_static_metadata_refcounts[34], {{g_bytes + 445, 7}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 452, 8}}}, + {&grpc_static_metadata_refcounts[36], {{g_bytes + 460, 16}}}, + {&grpc_static_metadata_refcounts[37], {{g_bytes + 476, 4}}}, + {&grpc_static_metadata_refcounts[38], {{g_bytes + 480, 3}}}, + {&grpc_static_metadata_refcounts[39], {{g_bytes + 483, 3}}}, + {&grpc_static_metadata_refcounts[40], {{g_bytes + 486, 4}}}, + {&grpc_static_metadata_refcounts[41], {{g_bytes + 490, 5}}}, + {&grpc_static_metadata_refcounts[42], {{g_bytes + 495, 4}}}, + {&grpc_static_metadata_refcounts[43], {{g_bytes + 499, 3}}}, + {&grpc_static_metadata_refcounts[44], {{g_bytes + 502, 3}}}, + {&grpc_static_metadata_refcounts[45], {{g_bytes + 505, 1}}}, + {&grpc_static_metadata_refcounts[46], {{g_bytes + 506, 11}}}, + {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 3}}}, + {&grpc_static_metadata_refcounts[48], {{g_bytes + 520, 3}}}, + {&grpc_static_metadata_refcounts[49], {{g_bytes + 523, 3}}}, + {&grpc_static_metadata_refcounts[50], {{g_bytes + 526, 3}}}, + {&grpc_static_metadata_refcounts[51], {{g_bytes + 529, 3}}}, + {&grpc_static_metadata_refcounts[52], {{g_bytes + 532, 14}}}, + {&grpc_static_metadata_refcounts[53], {{g_bytes + 546, 13}}}, + {&grpc_static_metadata_refcounts[54], {{g_bytes + 559, 15}}}, + {&grpc_static_metadata_refcounts[55], {{g_bytes + 574, 13}}}, + {&grpc_static_metadata_refcounts[56], {{g_bytes + 587, 6}}}, + {&grpc_static_metadata_refcounts[57], {{g_bytes + 593, 27}}}, + {&grpc_static_metadata_refcounts[58], {{g_bytes + 620, 3}}}, + {&grpc_static_metadata_refcounts[59], {{g_bytes + 623, 5}}}, + {&grpc_static_metadata_refcounts[60], {{g_bytes + 628, 13}}}, + {&grpc_static_metadata_refcounts[61], {{g_bytes + 641, 13}}}, + {&grpc_static_metadata_refcounts[62], {{g_bytes + 654, 19}}}, + {&grpc_static_metadata_refcounts[63], {{g_bytes + 673, 16}}}, + {&grpc_static_metadata_refcounts[64], {{g_bytes + 689, 14}}}, + {&grpc_static_metadata_refcounts[65], {{g_bytes + 703, 16}}}, + {&grpc_static_metadata_refcounts[66], {{g_bytes + 719, 13}}}, + {&grpc_static_metadata_refcounts[67], {{g_bytes + 732, 6}}}, + {&grpc_static_metadata_refcounts[68], {{g_bytes + 738, 4}}}, + {&grpc_static_metadata_refcounts[69], {{g_bytes + 742, 4}}}, + {&grpc_static_metadata_refcounts[70], {{g_bytes + 746, 6}}}, + {&grpc_static_metadata_refcounts[71], {{g_bytes + 752, 7}}}, + {&grpc_static_metadata_refcounts[72], {{g_bytes + 759, 4}}}, + {&grpc_static_metadata_refcounts[73], {{g_bytes + 763, 8}}}, + {&grpc_static_metadata_refcounts[74], {{g_bytes + 771, 17}}}, + {&grpc_static_metadata_refcounts[75], {{g_bytes + 788, 13}}}, + {&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}}, + {&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 19}}}, + {&grpc_static_metadata_refcounts[78], {{g_bytes + 828, 13}}}, + {&grpc_static_metadata_refcounts[79], {{g_bytes + 841, 11}}}, + {&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 4}}}, + {&grpc_static_metadata_refcounts[81], {{g_bytes + 856, 8}}}, + {&grpc_static_metadata_refcounts[82], {{g_bytes + 864, 12}}}, + {&grpc_static_metadata_refcounts[83], {{g_bytes + 876, 18}}}, + {&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 19}}}, + {&grpc_static_metadata_refcounts[85], {{g_bytes + 913, 5}}}, + {&grpc_static_metadata_refcounts[86], {{g_bytes + 918, 7}}}, + {&grpc_static_metadata_refcounts[87], {{g_bytes + 925, 7}}}, + {&grpc_static_metadata_refcounts[88], {{g_bytes + 932, 11}}}, + {&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 6}}}, + {&grpc_static_metadata_refcounts[90], {{g_bytes + 949, 10}}}, + {&grpc_static_metadata_refcounts[91], {{g_bytes + 959, 25}}}, + {&grpc_static_metadata_refcounts[92], {{g_bytes + 984, 17}}}, + {&grpc_static_metadata_refcounts[93], {{g_bytes + 1001, 4}}}, + {&grpc_static_metadata_refcounts[94], {{g_bytes + 1005, 3}}}, + {&grpc_static_metadata_refcounts[95], {{g_bytes + 1008, 16}}}, + {&grpc_static_metadata_refcounts[96], {{g_bytes + 1024, 16}}}, + {&grpc_static_metadata_refcounts[97], {{g_bytes + 1040, 13}}}, + {&grpc_static_metadata_refcounts[98], {{g_bytes + 1053, 12}}}, + {&grpc_static_metadata_refcounts[99], {{g_bytes + 1065, 21}}}, }; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { @@ -478,350 +378,178 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { } grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { - {{.refcount = &grpc_static_metadata_refcounts[7], - .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 430, 1}}}, - {{.refcount = &grpc_static_metadata_refcounts[7], - .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 431, 1}}}, - {{.refcount = &grpc_static_metadata_refcounts[7], - .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 432, 1}}}, - {{.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 433, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 441, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, - {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 445, 7}}}, - {{.refcount = &grpc_static_metadata_refcounts[5], - .data.refcounted = {g_bytes + 36, 2}}, - {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 452, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[14], - .data.refcounted = {g_bytes + 158, 12}}, - {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 460, 16}}}, - {{.refcount = &grpc_static_metadata_refcounts[1], - .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 476, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 480, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 483, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, - {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 486, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, - {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 490, 5}}}, - {{.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, - {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 495, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[3], - .data.refcounted = {g_bytes + 19, 10}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[1], - .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 499, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[1], - .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 502, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[0], - .data.refcounted = {g_bytes + 0, 5}}, - {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 505, 1}}}, - {{.refcount = &grpc_static_metadata_refcounts[0], - .data.refcounted = {g_bytes + 0, 5}}, - {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 506, 11}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 517, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 520, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 523, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 526, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, - {.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 529, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 532, 14}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 546, 13}}}, - {{.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 559, 15}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 574, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 587, 6}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 593, 27}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 620, 3}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 623, 5}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 628, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 641, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 654, 19}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 170, 16}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 433, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 170, 16}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 441, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 170, 16}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 673, 16}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 689, 14}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 703, 16}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 719, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[14], - .data.refcounted = {g_bytes + 158, 12}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 732, 6}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 738, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 742, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 746, 6}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 752, 7}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 759, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 278, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 763, 8}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 771, 17}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 788, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 801, 8}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 809, 19}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 828, 13}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[21], - .data.refcounted = {g_bytes + 282, 8}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 841, 11}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 852, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 856, 8}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 864, 12}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 876, 18}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 894, 19}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 913, 5}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 918, 7}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 925, 7}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 932, 11}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 943, 6}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 949, 10}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 959, 25}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 984, 17}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 268, 10}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 1001, 4}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 1005, 3}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 1008, 16}}, - {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 302, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 433, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 445, 7}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 1024, 16}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 441, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1040, 13}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[98], - .data.refcounted = {g_bytes + 1053, 12}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[99], - .data.refcounted = {g_bytes + 1065, 21}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 433, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 441, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 186, 15}}, - {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1040, 13}}}, + {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, + {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 1}}}}, + {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 431, 1}}}}, + {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, + {&grpc_static_metadata_refcounts[31], {{g_bytes + 432, 1}}}}, + {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 433, 8}}}}, + {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 441, 4}}}}, + {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, + {&grpc_static_metadata_refcounts[34], {{g_bytes + 445, 7}}}}, + {{&grpc_static_metadata_refcounts[5], {{g_bytes + 36, 2}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 452, 8}}}}, + {{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}}, + {&grpc_static_metadata_refcounts[36], {{g_bytes + 460, 16}}}}, + {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, + {&grpc_static_metadata_refcounts[37], {{g_bytes + 476, 4}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[38], {{g_bytes + 480, 3}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[39], {{g_bytes + 483, 3}}}}, + {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, + {&grpc_static_metadata_refcounts[40], {{g_bytes + 486, 4}}}}, + {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, + {&grpc_static_metadata_refcounts[41], {{g_bytes + 490, 5}}}}, + {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, + {&grpc_static_metadata_refcounts[42], {{g_bytes + 495, 4}}}}, + {{&grpc_static_metadata_refcounts[3], {{g_bytes + 19, 10}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, + {&grpc_static_metadata_refcounts[43], {{g_bytes + 499, 3}}}}, + {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, + {&grpc_static_metadata_refcounts[44], {{g_bytes + 502, 3}}}}, + {{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}}, + {&grpc_static_metadata_refcounts[45], {{g_bytes + 505, 1}}}}, + {{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}}, + {&grpc_static_metadata_refcounts[46], {{g_bytes + 506, 11}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 3}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[48], {{g_bytes + 520, 3}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[49], {{g_bytes + 523, 3}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[50], {{g_bytes + 526, 3}}}}, + {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, + {&grpc_static_metadata_refcounts[51], {{g_bytes + 529, 3}}}}, + {{&grpc_static_metadata_refcounts[52], {{g_bytes + 532, 14}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[53], {{g_bytes + 546, 13}}}}, + {{&grpc_static_metadata_refcounts[54], {{g_bytes + 559, 15}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[55], {{g_bytes + 574, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[56], {{g_bytes + 587, 6}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[57], {{g_bytes + 593, 27}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[58], {{g_bytes + 620, 3}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[59], {{g_bytes + 623, 5}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[60], {{g_bytes + 628, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[61], {{g_bytes + 641, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[62], {{g_bytes + 654, 19}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 433, 8}}}}, + {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 441, 4}}}}, + {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[63], {{g_bytes + 673, 16}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[64], {{g_bytes + 689, 14}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[65], {{g_bytes + 703, 16}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[66], {{g_bytes + 719, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[67], {{g_bytes + 732, 6}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[68], {{g_bytes + 738, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[69], {{g_bytes + 742, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[70], {{g_bytes + 746, 6}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[71], {{g_bytes + 752, 7}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[72], {{g_bytes + 759, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[20], {{g_bytes + 278, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[73], {{g_bytes + 763, 8}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[74], {{g_bytes + 771, 17}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[75], {{g_bytes + 788, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 19}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[78], {{g_bytes + 828, 13}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[21], {{g_bytes + 282, 8}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[79], {{g_bytes + 841, 11}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[81], {{g_bytes + 856, 8}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[82], {{g_bytes + 864, 12}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[83], {{g_bytes + 876, 18}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 19}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[85], {{g_bytes + 913, 5}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[86], {{g_bytes + 918, 7}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[87], {{g_bytes + 925, 7}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[88], {{g_bytes + 932, 11}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 6}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[90], {{g_bytes + 949, 10}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[91], {{g_bytes + 959, 25}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[92], {{g_bytes + 984, 17}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[19], {{g_bytes + 268, 10}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[93], {{g_bytes + 1001, 4}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[94], {{g_bytes + 1005, 3}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[95], {{g_bytes + 1008, 16}}}, + {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 433, 8}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[34], {{g_bytes + 445, 7}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[96], {{g_bytes + 1024, 16}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 441, 4}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[97], {{g_bytes + 1040, 13}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[98], {{g_bytes + 1053, 12}}}}, + {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, + {&grpc_static_metadata_refcounts[99], {{g_bytes + 1065, 21}}}}, + {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 433, 8}}}}, + {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 441, 4}}}}, + {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, + {&grpc_static_metadata_refcounts[97], {{g_bytes + 1040, 13}}}}, }; bool grpc_static_callout_is_default[GRPC_BATCH_CALLOUTS_COUNT] = { true, // :path diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 6ee8a7cace..af7521da36 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -370,8 +370,8 @@ for i, elem in enumerate(all_strs): def slice_def(i): - return ('{.refcount = &grpc_static_metadata_refcounts[%d], .data.refcounted =' - ' {g_bytes+%d, %d}}') % ( + return ('{&grpc_static_metadata_refcounts[%d],' + ' {{g_bytes+%d, %d}}}') % ( i, id2strofs[i], len(all_strs[i])) -- cgit v1.2.3 From 341c7e7eca06e1c66ed2448fb3bcda6d278f5fd6 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 18 Sep 2017 13:37:28 -0700 Subject: Timer generic correction --- src/core/lib/iomgr/timer_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index 57b63cb229..dc4df807b8 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -95,8 +95,7 @@ struct shared_mutables { gpr_mu mu; } GPR_ALIGN_STRUCT(GPR_CACHELINE_SIZE); -static struct shared_mutables g_shared_mutables = { - 0, GPR_SPINLOCK_STATIC_INITIALIZER, false, {{0}}}; +static struct shared_mutables g_shared_mutables; static gpr_clock_type g_clock_type; static gpr_timespec g_start_time; @@ -154,6 +153,7 @@ void grpc_timer_list_init(gpr_timespec now) { uint32_t i; g_shared_mutables.initialized = true; + g_shared_mutables.checker_mu = GPR_SPINLOCK_STATIC_INITIALIZER; gpr_mu_init(&g_shared_mutables.mu); g_clock_type = now.clock_type; g_start_time = now; -- cgit v1.2.3 From e203067bdcd9522446aa106ce77085c62a932c49 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 18 Sep 2017 14:44:58 -0700 Subject: initializing checker_mu in timer_list to be safe --- src/core/lib/iomgr/timer_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c index dc4df807b8..e9a7236c8c 100644 --- a/src/core/lib/iomgr/timer_generic.c +++ b/src/core/lib/iomgr/timer_generic.c @@ -153,7 +153,7 @@ void grpc_timer_list_init(gpr_timespec now) { uint32_t i; g_shared_mutables.initialized = true; - g_shared_mutables.checker_mu = GPR_SPINLOCK_STATIC_INITIALIZER; + g_shared_mutables.checker_mu = GPR_SPINLOCK_INITIALIZER; gpr_mu_init(&g_shared_mutables.mu); g_clock_type = now.clock_type; g_start_time = now; -- cgit v1.2.3 From 06312bdb43c66150e59958479640913c3726ee10 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 18 Sep 2017 15:10:22 -0700 Subject: Minor formatting, commenting and clang format for C to C++ conversion --- include/grpc/slice.h | 4 ---- .../filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c | 2 +- src/core/ext/transport/chttp2/transport/hpack_encoder.c | 2 +- src/core/lib/iomgr/ev_epoll1_linux.c | 6 +++++- src/core/lib/iomgr/ev_epollex_linux.c | 6 +++++- 5 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/include/grpc/slice.h b/include/grpc/slice.h index 3080d63e2b..3f3cff1408 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -66,10 +66,6 @@ GPRAPI grpc_slice grpc_slice_malloc(size_t length); GPRAPI grpc_slice grpc_slice_malloc_large(size_t length); #define GRPC_SLICE_MALLOC(len) grpc_slice_malloc(len) -/* ((len) <= GRPC_SLICE_INLINED_SIZE \ - ? (grpc_slice){.refcount = NULL, \ - .data.inlined = {.length = (uint8_t)(len)}} \ - : grpc_slice_malloc_large((len)))*/ /** Intern a slice: diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c index 9975b1ef79..04379975e1 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c @@ -276,7 +276,7 @@ static void on_txt_done_cb(void *arg, int status, int timeouts, char *error_msg; grpc_ares_request *r = (grpc_ares_request *)arg; const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1; - struct ares_txt_ext *result; + struct ares_txt_ext *result = NULL; struct ares_txt_ext *reply = NULL; grpc_error *error = GRPC_ERROR_NONE; gpr_mu_lock(&r->mu); diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 52c9e217f1..9dfbd3c3a9 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -53,7 +53,7 @@ static grpc_slice_refcount terminal_slice_refcount = {NULL, NULL}; static const grpc_slice terminal_slice = { &terminal_slice_refcount, /* refcount */ - {{0, 0}} /* refcounted */ + {{0, 0}} /* data.refcounted */ }; extern grpc_tracer_flag grpc_http_trace; diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index b5066e5f58..7fde45865e 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -568,7 +568,11 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, return 0; } - static const gpr_timespec round_up = {0, GPR_NS_PER_MS - 1, GPR_TIMESPAN}; + static const gpr_timespec round_up = { + 0, /* tv_sec */ + GPR_NS_PER_MS - 1, /* tv_nsec */ + GPR_TIMESPAN /* clock_type */ + }; timeout = gpr_time_sub(deadline, now); int millis = gpr_time_to_millis(gpr_time_add(timeout, round_up)); return millis >= 1 ? millis : 1; diff --git a/src/core/lib/iomgr/ev_epollex_linux.c b/src/core/lib/iomgr/ev_epollex_linux.c index 671c4cd730..cff0c07a2b 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.c +++ b/src/core/lib/iomgr/ev_epollex_linux.c @@ -706,7 +706,11 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, return 0; } - static const gpr_timespec round_up = {0, GPR_NS_PER_MS - 1, GPR_TIMESPAN}; + static const gpr_timespec round_up = { + 0, /* tv_sec */ + GPR_NS_PER_MS - 1, /* tv_nsec */ + GPR_TIMESPAN /* clock_type */ + }; timeout = gpr_time_sub(deadline, now); int millis = gpr_time_to_millis(gpr_time_add(timeout, round_up)); return millis >= 1 ? millis : 1; -- cgit v1.2.3 From 2746bd59982a5c186cf12d2007c73bd9fc4c3e33 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 19 Sep 2017 11:12:55 -0700 Subject: Fix cython definition to match c definition This is required to compile with Cython options that are more strict about const correctness. --- src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 2 +- src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 28cf114451..840af5c43a 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -523,7 +523,7 @@ cdef extern from "grpc/compression.h": int grpc_compression_algorithm_parse( grpc_slice value, grpc_compression_algorithm *algorithm) nogil int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm, - char **name) nogil + const char **name) nogil grpc_compression_algorithm grpc_compression_algorithm_for_level( grpc_compression_level level, uint32_t accepted_encodings) nogil void grpc_compression_options_init(grpc_compression_options *opts) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index 0a2a6eee05..d860173b5d 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -782,7 +782,7 @@ cdef class CompressionOptions: def compression_algorithm_name(grpc_compression_algorithm algorithm): - cdef char* name + cdef const char* name with nogil: grpc_compression_algorithm_name(algorithm, &name) # Let Cython do the right thing with string casting -- cgit v1.2.3 From 7fcdd7add07a4390c8d2e430d519602206433159 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 19 Sep 2017 14:11:21 -0700 Subject: Really spell out code generation --- src/core/lib/debug/stats_data.c | 14 ++++++++++++++ tools/codegen/core/gen_stats_data.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/lib/debug/stats_data.c b/src/core/lib/debug/stats_data.c index e4723dac0a..8eaf308b71 100644 --- a/src/core/lib/debug/stats_data.c +++ b/src/core/lib/debug/stats_data.c @@ -278,6 +278,7 @@ const uint8_t grpc_stats_table_7[102] = { const int grpc_stats_table_8[9] = {0, 1, 2, 4, 7, 13, 23, 39, 64}; const uint8_t grpc_stats_table_9[9] = {0, 0, 1, 2, 2, 3, 4, 4, 5}; void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 262144); if (value < 6) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE, @@ -303,6 +304,7 @@ void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int value) { (exec_ctx), value, grpc_stats_table_0, 64)); } void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 29) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), @@ -329,6 +331,7 @@ void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int value) { (exec_ctx), value, grpc_stats_table_2, 128)); } void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE, @@ -354,6 +357,7 @@ void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) { (exec_ctx), value, grpc_stats_table_4, 64)); } void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), @@ -379,6 +383,7 @@ void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) { (exec_ctx), value, grpc_stats_table_6, 64)); } void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE, @@ -404,6 +409,7 @@ void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) { (exec_ctx), value, grpc_stats_table_4, 64)); } void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER, @@ -430,6 +436,7 @@ void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) { } void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -457,6 +464,7 @@ void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx, } void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 16777216); if (value < 5) { GRPC_STATS_INC_HISTOGRAM( @@ -484,6 +492,7 @@ void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx, } void grpc_stats_inc_http2_send_initial_metadata_per_write( grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -513,6 +522,7 @@ void grpc_stats_inc_http2_send_initial_metadata_per_write( } void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -540,6 +550,7 @@ void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx, } void grpc_stats_inc_http2_send_trailing_metadata_per_write( grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -569,6 +580,7 @@ void grpc_stats_inc_http2_send_trailing_metadata_per_write( } void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -596,6 +608,7 @@ void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx, } void grpc_stats_inc_executor_closures_per_wakeup(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 1024); if (value < 13) { GRPC_STATS_INC_HISTOGRAM( @@ -622,6 +635,7 @@ void grpc_stats_inc_executor_closures_per_wakeup(grpc_exec_ctx *exec_ctx, (exec_ctx), value, grpc_stats_table_6, 64)); } void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx *exec_ctx, int value) { + /* Automatically generated by tools/codegen/core/gen_stats_data.py */ value = GPR_CLAMP(value, 0, 64); if (value < 3) { GRPC_STATS_INC_HISTOGRAM((exec_ctx), diff --git a/tools/codegen/core/gen_stats_data.py b/tools/codegen/core/gen_stats_data.py index 8359734c84..10ad0cc831 100755 --- a/tools/codegen/core/gen_stats_data.py +++ b/tools/codegen/core/gen_stats_data.py @@ -147,7 +147,8 @@ def gen_bucket_code(histogram): shift_data = find_ideal_shift(code_bounds[first_nontrivial:], 256 * histogram.buckets) #print first_nontrivial, shift_data, bounds #if shift_data is not None: print [hex(x >> shift_data[0]) for x in code_bounds[first_nontrivial:]] - code = 'value = GPR_CLAMP(value, 0, %d);\n' % histogram.max + code = '\n/* Automatically generated by tools/codegen/core/gen_stats_data.py */\n' + code += 'value = GPR_CLAMP(value, 0, %d);\n' % histogram.max map_table = gen_map_table(code_bounds[first_nontrivial:], shift_data) if first_nontrivial is None: code += ('GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_%s, value);\n' @@ -407,4 +408,3 @@ with open('src/core/lib/debug/stats_data_bq_schema.sql', 'w') as S: for counter in inst_map['Counter']: columns.append(('%s_per_iteration' % counter.name, 'FLOAT')) print >>S, ',\n'.join('%s:%s' % x for x in columns) - -- cgit v1.2.3 From 85629d069638acb5f8834dcff053debde98c69a7 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 19 Sep 2017 16:47:12 -0700 Subject: Add missing exec_ctx parameter to pollset_uv.c --- src/core/lib/iomgr/pollset_uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c index a79fe89d3e..2651325e25 100644 --- a/src/core/lib/iomgr/pollset_uv.c +++ b/src/core/lib/iomgr/pollset_uv.c @@ -145,7 +145,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, return GRPC_ERROR_NONE; } -grpc_error *grpc_pollset_kick(grpc_pollset *pollset, +grpc_error *grpc_pollset_kick(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker *specific_worker) { GRPC_UV_ASSERT_SAME_THREAD(); uv_timer_start(dummy_uv_handle, dummy_timer_cb, 0, 0); -- cgit v1.2.3