grpc 1.6.7 → 1.7.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +579 -77
  3. data/include/grpc/byte_buffer.h +1 -63
  4. data/include/grpc/compression.h +27 -5
  5. data/include/grpc/fork.h +24 -0
  6. data/include/grpc/grpc.h +12 -6
  7. data/include/grpc/grpc_security.h +28 -7
  8. data/include/grpc/impl/codegen/atm.h +1 -0
  9. data/include/grpc/impl/codegen/byte_buffer.h +86 -0
  10. data/include/grpc/impl/codegen/compression_types.h +63 -5
  11. data/include/grpc/impl/codegen/fork.h +48 -0
  12. data/include/grpc/impl/codegen/grpc_types.h +26 -9
  13. data/include/grpc/impl/codegen/port_platform.h +11 -4
  14. data/include/grpc/impl/codegen/slice.h +6 -1
  15. data/include/grpc/impl/codegen/sync.h +3 -1
  16. data/include/grpc/impl/codegen/sync_custom.h +36 -0
  17. data/include/grpc/module.modulemap +75 -3
  18. data/include/grpc/slice.h +1 -5
  19. data/include/grpc/support/sync_custom.h +24 -0
  20. data/src/core/ext/census/base_resources.c +14 -14
  21. data/src/core/ext/census/context.c +7 -5
  22. data/src/core/ext/census/grpc_filter.c +12 -14
  23. data/src/core/ext/census/mlog.c +2 -1
  24. data/src/core/ext/census/resource.c +13 -9
  25. data/src/core/ext/filters/client_channel/channel_connectivity.c +15 -8
  26. data/src/core/ext/filters/client_channel/client_channel.c +418 -439
  27. data/src/core/ext/filters/client_channel/client_channel_factory.c +4 -5
  28. data/src/core/ext/filters/client_channel/client_channel_plugin.c +2 -2
  29. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +7 -5
  30. data/src/core/ext/filters/client_channel/http_proxy.c +17 -21
  31. data/src/core/ext/filters/client_channel/lb_policy.c +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +7 -7
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +371 -257
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +7 -5
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +25 -14
  36. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +16 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +33 -28
  38. data/src/core/ext/filters/client_channel/lb_policy_factory.c +10 -8
  39. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
  40. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +1 -1
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +7 -6
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +62 -28
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +29 -23
  44. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +25 -14
  45. data/src/core/ext/filters/client_channel/retry_throttle.c +9 -6
  46. data/src/core/ext/filters/client_channel/subchannel.c +30 -30
  47. data/src/core/ext/filters/client_channel/subchannel.h +1 -4
  48. data/src/core/ext/filters/client_channel/subchannel_index.c +31 -15
  49. data/src/core/ext/filters/client_channel/subchannel_index.h +7 -0
  50. data/src/core/ext/filters/client_channel/uri_parser.c +4 -3
  51. data/src/core/ext/filters/deadline/deadline_filter.c +78 -39
  52. data/src/core/ext/filters/deadline/deadline_filter.h +7 -1
  53. data/src/core/ext/filters/http/client/http_client_filter.c +14 -14
  54. data/src/core/ext/filters/http/http_filters_plugin.c +1 -1
  55. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +240 -175
  56. data/src/core/ext/filters/http/server/http_server_filter.c +48 -36
  57. data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c} +11 -12
  58. data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h} +6 -5
  59. data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c} +19 -13
  60. data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h} +4 -3
  61. data/src/core/ext/filters/max_age/max_age_filter.c +2 -3
  62. data/src/core/ext/filters/message_size/message_size_filter.c +4 -2
  63. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +0 -1
  64. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +5 -5
  65. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  66. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +1 -1
  67. data/src/core/ext/transport/chttp2/server/chttp2_server.c +20 -18
  68. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +1 -0
  69. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +493 -210
  70. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  71. data/src/core/ext/transport/chttp2/transport/flow_control.c +9 -8
  72. data/src/core/ext/transport/chttp2/transport/frame_data.c +2 -2
  73. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +2 -2
  74. data/src/core/ext/transport/chttp2/transport/frame_ping.c +5 -4
  75. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  76. data/src/core/ext/transport/chttp2/transport/frame_settings.c +10 -9
  77. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +9 -5
  78. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +62 -41
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +52 -8
  80. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  81. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +3 -2
  82. data/src/core/ext/transport/chttp2/transport/internal.h +60 -30
  83. data/src/core/ext/transport/chttp2/transport/parsing.c +16 -5
  84. data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -16
  85. data/src/core/ext/transport/chttp2/transport/stream_map.c +6 -4
  86. data/src/core/ext/transport/chttp2/transport/writing.c +133 -105
  87. data/src/core/ext/transport/inproc/inproc_transport.c +61 -65
  88. data/src/core/lib/channel/channel_args.c +112 -12
  89. data/src/core/lib/channel/channel_args.h +31 -0
  90. data/src/core/lib/channel/channel_stack.c +1 -15
  91. data/src/core/lib/channel/channel_stack.h +3 -10
  92. data/src/core/lib/channel/channel_stack_builder.c +41 -10
  93. data/src/core/lib/channel/channel_stack_builder.h +10 -0
  94. data/src/core/lib/channel/connected_channel.c +94 -23
  95. data/src/core/lib/channel/handshaker.c +8 -6
  96. data/src/core/lib/channel/handshaker_registry.c +1 -1
  97. data/src/core/lib/compression/algorithm_metadata.h +14 -0
  98. data/src/core/lib/compression/compression.c +101 -1
  99. data/src/core/lib/compression/stream_compression.c +32 -146
  100. data/src/core/lib/compression/stream_compression.h +28 -4
  101. data/src/core/lib/compression/stream_compression_gzip.c +228 -0
  102. data/src/core/lib/{iomgr/ev_epoll_thread_pool_linux.h → compression/stream_compression_gzip.h} +5 -7
  103. data/src/core/lib/compression/stream_compression_identity.c +94 -0
  104. data/src/core/lib/{iomgr/ev_epoll_limited_pollers_linux.h → compression/stream_compression_identity.h} +7 -8
  105. data/src/core/lib/debug/stats.c +174 -0
  106. data/src/core/lib/debug/stats.h +61 -0
  107. data/src/core/lib/debug/stats_data.c +687 -0
  108. data/src/core/lib/debug/stats_data.h +470 -0
  109. data/src/core/lib/debug/trace.c +3 -3
  110. data/src/core/lib/debug/trace.h +1 -1
  111. data/src/core/lib/http/format_request.c +1 -1
  112. data/src/core/lib/http/httpcli.c +8 -7
  113. data/src/core/lib/http/httpcli_security_connector.c +2 -1
  114. data/src/core/lib/http/parser.c +4 -3
  115. data/src/core/lib/iomgr/call_combiner.c +202 -0
  116. data/src/core/lib/iomgr/call_combiner.h +121 -0
  117. data/src/core/lib/iomgr/closure.c +18 -4
  118. data/src/core/lib/iomgr/combiner.c +11 -4
  119. data/src/core/lib/iomgr/error.c +26 -24
  120. data/src/core/lib/iomgr/ev_epoll1_linux.c +395 -212
  121. data/src/core/lib/iomgr/ev_epollex_linux.c +141 -128
  122. data/src/core/lib/iomgr/ev_epollsig_linux.c +44 -41
  123. data/src/core/lib/iomgr/ev_poll_posix.c +99 -75
  124. data/src/core/lib/iomgr/ev_posix.c +5 -9
  125. data/src/core/lib/iomgr/ev_posix.h +1 -1
  126. data/src/core/lib/iomgr/exec_ctx.h +6 -1
  127. data/src/core/lib/iomgr/executor.c +142 -36
  128. data/src/core/lib/iomgr/executor.h +6 -1
  129. data/src/core/lib/iomgr/fork_posix.c +88 -0
  130. data/src/core/lib/iomgr/fork_windows.c +39 -0
  131. data/src/core/lib/iomgr/iocp_windows.c +2 -0
  132. data/src/core/lib/iomgr/iomgr.c +2 -8
  133. data/src/core/lib/iomgr/is_epollexclusive_available.c +6 -6
  134. data/src/core/lib/iomgr/load_file.c +2 -1
  135. data/src/core/lib/iomgr/polling_entity.c +9 -9
  136. data/src/core/lib/iomgr/polling_entity.h +7 -1
  137. data/src/core/lib/iomgr/pollset.h +1 -1
  138. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  139. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  140. data/src/core/lib/iomgr/port.h +4 -0
  141. data/src/core/lib/iomgr/resolve_address_posix.c +8 -7
  142. data/src/core/lib/iomgr/resolve_address_windows.c +1 -1
  143. data/src/core/lib/iomgr/resource_quota.c +24 -19
  144. data/src/core/lib/iomgr/socket_factory_posix.c +4 -4
  145. data/src/core/lib/iomgr/socket_mutator.c +4 -4
  146. data/src/core/lib/iomgr/socket_utils_windows.c +0 -4
  147. data/src/core/lib/iomgr/tcp_client_posix.c +5 -4
  148. data/src/core/lib/iomgr/tcp_posix.c +181 -20
  149. data/src/core/lib/iomgr/tcp_server_posix.c +8 -7
  150. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +1 -1
  151. data/src/core/lib/iomgr/timer.h +4 -0
  152. data/src/core/lib/iomgr/timer_generic.c +138 -3
  153. data/src/core/lib/iomgr/timer_generic.h +3 -0
  154. data/src/core/lib/iomgr/timer_heap.c +4 -4
  155. data/src/core/lib/iomgr/timer_manager.c +2 -2
  156. data/src/core/lib/iomgr/timer_uv.c +2 -0
  157. data/src/core/lib/iomgr/udp_server.c +10 -8
  158. data/src/core/lib/iomgr/unix_sockets_posix.c +4 -2
  159. data/src/core/lib/iomgr/wakeup_fd_cv.c +9 -8
  160. data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -2
  161. data/src/core/lib/json/json.c +1 -1
  162. data/src/core/lib/json/json_string.c +13 -13
  163. data/src/core/lib/profiling/timers.h +18 -8
  164. data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -10
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +2 -1
  166. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +11 -6
  167. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +4 -4
  168. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +132 -50
  169. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  170. data/src/core/lib/security/transport/client_auth_filter.c +68 -135
  171. data/src/core/lib/security/transport/secure_endpoint.c +110 -90
  172. data/src/core/lib/security/transport/secure_endpoint.h +8 -3
  173. data/src/core/lib/security/transport/security_connector.c +10 -12
  174. data/src/core/lib/security/transport/security_handshaker.c +45 -24
  175. data/src/core/lib/security/transport/server_auth_filter.c +71 -20
  176. data/src/core/lib/slice/b64.c +2 -2
  177. data/src/core/lib/slice/slice.c +16 -14
  178. data/src/core/lib/slice/slice_buffer.c +5 -4
  179. data/src/core/lib/slice/slice_hash_table.c +3 -2
  180. data/src/core/lib/slice/slice_intern.c +8 -5
  181. data/src/core/lib/support/block_annotate.h +22 -0
  182. data/src/core/lib/support/fork.c +62 -0
  183. data/src/core/lib/support/fork.h +35 -0
  184. data/src/core/lib/support/log_linux.c +1 -1
  185. data/src/core/lib/support/string.c +15 -1
  186. data/src/core/lib/support/string.h +3 -0
  187. data/src/core/lib/support/thd_internal.h +6 -0
  188. data/src/core/lib/support/thd_posix.c +56 -0
  189. data/src/core/lib/support/thd_windows.c +2 -0
  190. data/src/core/lib/surface/alarm.c +22 -15
  191. data/src/core/lib/surface/byte_buffer.c +4 -2
  192. data/src/core/lib/surface/call.c +442 -141
  193. data/src/core/lib/surface/call.h +6 -6
  194. data/src/core/lib/surface/call_log_batch.c +1 -1
  195. data/src/core/lib/surface/call_test_only.h +12 -0
  196. data/src/core/lib/surface/channel.c +39 -4
  197. data/src/core/lib/surface/channel_init.c +6 -6
  198. data/src/core/lib/surface/channel_ping.c +2 -2
  199. data/src/core/lib/surface/completion_queue.c +56 -57
  200. data/src/core/lib/surface/init.c +17 -3
  201. data/src/core/lib/surface/init_secure.c +5 -1
  202. data/src/core/lib/surface/lame_client.cc +9 -10
  203. data/src/core/lib/surface/server.c +81 -72
  204. data/src/core/lib/surface/version.c +2 -2
  205. data/src/core/lib/transport/byte_stream.c +1 -0
  206. data/src/core/lib/transport/byte_stream.h +3 -1
  207. data/src/core/lib/transport/connectivity_state.c +2 -1
  208. data/src/core/lib/transport/metadata.c +7 -4
  209. data/src/core/lib/transport/metadata_batch.c +18 -16
  210. data/src/core/lib/transport/metadata_batch.h +1 -0
  211. data/src/core/lib/transport/service_config.c +5 -3
  212. data/src/core/lib/transport/static_metadata.c +395 -614
  213. data/src/core/lib/transport/static_metadata.h +165 -133
  214. data/src/core/lib/transport/status_conversion.c +1 -1
  215. data/src/core/lib/transport/transport.c +20 -20
  216. data/src/core/lib/transport/transport.h +8 -5
  217. data/src/core/lib/transport/transport_impl.h +0 -3
  218. data/src/core/lib/transport/transport_op_string.c +8 -1
  219. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -4
  220. data/src/core/tsi/fake_transport_security.c +133 -2
  221. data/src/core/tsi/fake_transport_security.h +5 -0
  222. data/src/core/tsi/ssl_transport_security.c +105 -8
  223. data/src/core/tsi/ssl_transport_security.h +30 -7
  224. data/src/core/tsi/transport_security.h +8 -2
  225. data/src/core/tsi/transport_security_grpc.c +20 -13
  226. data/src/core/tsi/transport_security_grpc.h +13 -9
  227. data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
  228. data/src/ruby/ext/grpc/rb_grpc.c +1 -1
  229. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
  230. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
  231. data/src/ruby/lib/grpc.rb +1 -0
  232. data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
  233. data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
  234. data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
  235. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  236. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  237. data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
  238. data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
  239. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
  240. data/src/ruby/lib/grpc/version.rb +1 -1
  241. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
  242. data/src/ruby/spec/channel_connection_spec.rb +1 -34
  243. data/src/ruby/spec/client_server_spec.rb +188 -82
  244. data/src/ruby/spec/generic/active_call_spec.rb +65 -11
  245. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  246. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  247. data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
  248. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
  249. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  250. data/src/ruby/spec/spec_helper.rb +4 -0
  251. data/src/ruby/spec/support/helpers.rb +73 -0
  252. data/src/ruby/spec/support/services.rb +147 -0
  253. data/third_party/cares/ares_build.h +21 -62
  254. data/third_party/cares/cares/ares.h +23 -1
  255. data/third_party/cares/cares/ares__close_sockets.c +2 -2
  256. data/third_party/cares/cares/ares_create_query.c +3 -3
  257. data/third_party/cares/cares/ares_expand_name.c +6 -2
  258. data/third_party/cares/cares/ares_expand_string.c +1 -1
  259. data/third_party/cares/cares/ares_getnameinfo.c +27 -7
  260. data/third_party/cares/cares/ares_init.c +407 -39
  261. data/third_party/cares/cares/ares_library_init.c +10 -0
  262. data/third_party/cares/cares/ares_library_init.h +2 -1
  263. data/third_party/cares/cares/ares_nowarn.c +6 -6
  264. data/third_party/cares/cares/ares_nowarn.h +2 -2
  265. data/third_party/cares/cares/ares_parse_naptr_reply.c +6 -1
  266. data/third_party/cares/cares/ares_private.h +11 -0
  267. data/third_party/cares/cares/ares_process.c +126 -37
  268. data/third_party/cares/cares/ares_version.h +2 -2
  269. data/third_party/cares/cares/ares_writev.c +2 -2
  270. data/third_party/cares/cares/config-win32.h +8 -34
  271. data/third_party/cares/cares/inet_net_pton.c +2 -2
  272. data/third_party/cares/cares/setup_once.h +5 -5
  273. data/third_party/cares/config_darwin/ares_config.h +98 -196
  274. data/third_party/cares/config_linux/ares_config.h +103 -203
  275. metadata +47 -20
  276. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +0 -1957
  277. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +0 -1182
@@ -16,13 +16,11 @@
16
16
  *
17
17
  */
18
18
 
19
- #ifndef GRPC_CORE_LIB_IOMGR_EV_EPOLL_THREAD_POOL_LINUX_H
20
- #define GRPC_CORE_LIB_IOMGR_EV_EPOLL_THREAD_POOL_LINUX_H
19
+ #ifndef GRPC_CORE_LIB_COMPRESSION_STREAM_COMPRESSION_GZIP_H
20
+ #define GRPC_CORE_LIB_COMPRESSION_STREAM_COMPRESSION_GZIP_H
21
21
 
22
- #include "src/core/lib/iomgr/ev_posix.h"
23
- #include "src/core/lib/iomgr/port.h"
22
+ #include "src/core/lib/compression/stream_compression.h"
24
23
 
25
- const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux(
26
- bool requested_explicitly);
24
+ extern const grpc_stream_compression_vtable grpc_stream_compression_gzip_vtable;
27
25
 
28
- #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL_THREAD_POOL_LINUX_H */
26
+ #endif
@@ -0,0 +1,94 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #include <grpc/support/alloc.h>
20
+ #include <grpc/support/log.h>
21
+
22
+ #include "src/core/lib/compression/stream_compression_identity.h"
23
+ #include "src/core/lib/iomgr/exec_ctx.h"
24
+ #include "src/core/lib/slice/slice_internal.h"
25
+
26
+ #define OUTPUT_BLOCK_SIZE (1024)
27
+
28
+ /* Singleton context used for all identity streams. */
29
+ static grpc_stream_compression_context identity_ctx = {
30
+ .vtable = &grpc_stream_compression_identity_vtable};
31
+
32
+ static void grpc_stream_compression_pass_through(grpc_slice_buffer *in,
33
+ grpc_slice_buffer *out,
34
+ size_t *output_size,
35
+ size_t max_output_size) {
36
+ if (max_output_size >= in->length) {
37
+ if (output_size) {
38
+ *output_size = in->length;
39
+ }
40
+ grpc_slice_buffer_move_into(in, out);
41
+ } else {
42
+ if (output_size) {
43
+ *output_size = max_output_size;
44
+ }
45
+ grpc_slice_buffer_move_first(in, max_output_size, out);
46
+ }
47
+ }
48
+
49
+ static bool grpc_stream_compress_identity(grpc_stream_compression_context *ctx,
50
+ grpc_slice_buffer *in,
51
+ grpc_slice_buffer *out,
52
+ size_t *output_size,
53
+ size_t max_output_size,
54
+ grpc_stream_compression_flush flush) {
55
+ if (ctx == NULL) {
56
+ return false;
57
+ }
58
+ grpc_stream_compression_pass_through(in, out, output_size, max_output_size);
59
+ return true;
60
+ }
61
+
62
+ static bool grpc_stream_decompress_identity(
63
+ grpc_stream_compression_context *ctx, grpc_slice_buffer *in,
64
+ grpc_slice_buffer *out, size_t *output_size, size_t max_output_size,
65
+ bool *end_of_context) {
66
+ if (ctx == NULL) {
67
+ return false;
68
+ }
69
+ grpc_stream_compression_pass_through(in, out, output_size, max_output_size);
70
+ if (end_of_context) {
71
+ *end_of_context = false;
72
+ }
73
+ return true;
74
+ }
75
+
76
+ static grpc_stream_compression_context *
77
+ grpc_stream_compression_context_create_identity(
78
+ grpc_stream_compression_method method) {
79
+ GPR_ASSERT(method == GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS ||
80
+ method == GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS);
81
+ /* No context needed in this case. Use fake context instead. */
82
+ return (grpc_stream_compression_context *)&identity_ctx;
83
+ }
84
+
85
+ static void grpc_stream_compression_context_destroy_identity(
86
+ grpc_stream_compression_context *ctx) {
87
+ return;
88
+ }
89
+
90
+ const grpc_stream_compression_vtable grpc_stream_compression_identity_vtable = {
91
+ .compress = grpc_stream_compress_identity,
92
+ .decompress = grpc_stream_decompress_identity,
93
+ .context_create = grpc_stream_compression_context_create_identity,
94
+ .context_destroy = grpc_stream_compression_context_destroy_identity};
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015 gRPC authors.
3
+ * Copyright 2017 gRPC authors.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -16,13 +16,12 @@
16
16
  *
17
17
  */
18
18
 
19
- #ifndef GRPC_CORE_LIB_IOMGR_EV_EPOLL_LIMITED_POLLERS_LINUX_H
20
- #define GRPC_CORE_LIB_IOMGR_EV_EPOLL_LIMITED_POLLERS_LINUX_H
19
+ #ifndef GRPC_CORE_LIB_COMPRESSION_STREAM_COMPRESSION_IDENTITY_H
20
+ #define GRPC_CORE_LIB_COMPRESSION_STREAM_COMPRESSION_IDENTITY_H
21
21
 
22
- #include "src/core/lib/iomgr/ev_posix.h"
23
- #include "src/core/lib/iomgr/port.h"
22
+ #include "src/core/lib/compression/stream_compression.h"
24
23
 
25
- const grpc_event_engine_vtable *grpc_init_epoll_limited_pollers_linux(
26
- bool explicitly_requested);
24
+ extern const grpc_stream_compression_vtable
25
+ grpc_stream_compression_identity_vtable;
27
26
 
28
- #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL_LIMITED_POLLERS_LINUX_H */
27
+ #endif
@@ -0,0 +1,174 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #include "src/core/lib/debug/stats.h"
20
+
21
+ #include <inttypes.h>
22
+ #include <string.h>
23
+
24
+ #include <grpc/support/alloc.h>
25
+ #include <grpc/support/string_util.h>
26
+ #include <grpc/support/useful.h>
27
+
28
+ #include "src/core/lib/support/string.h"
29
+
30
+ grpc_stats_data *grpc_stats_per_cpu_storage = NULL;
31
+ static size_t g_num_cores;
32
+
33
+ void grpc_stats_init(void) {
34
+ g_num_cores = GPR_MAX(1, gpr_cpu_num_cores());
35
+ grpc_stats_per_cpu_storage =
36
+ (grpc_stats_data *)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores);
37
+ }
38
+
39
+ void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); }
40
+
41
+ void grpc_stats_collect(grpc_stats_data *output) {
42
+ memset(output, 0, sizeof(*output));
43
+ for (size_t core = 0; core < g_num_cores; core++) {
44
+ for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
45
+ output->counters[i] += gpr_atm_no_barrier_load(
46
+ &grpc_stats_per_cpu_storage[core].counters[i]);
47
+ }
48
+ for (size_t i = 0; i < GRPC_STATS_HISTOGRAM_BUCKETS; i++) {
49
+ output->histograms[i] += gpr_atm_no_barrier_load(
50
+ &grpc_stats_per_cpu_storage[core].histograms[i]);
51
+ }
52
+ }
53
+ }
54
+
55
+ void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a,
56
+ grpc_stats_data *c) {
57
+ for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
58
+ c->counters[i] = b->counters[i] - a->counters[i];
59
+ }
60
+ for (size_t i = 0; i < GRPC_STATS_HISTOGRAM_BUCKETS; i++) {
61
+ c->histograms[i] = b->histograms[i] - a->histograms[i];
62
+ }
63
+ }
64
+
65
+ int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value,
66
+ const int *table, int table_size) {
67
+ GRPC_STATS_INC_HISTOGRAM_SLOW_LOOKUPS(exec_ctx);
68
+ const int *const start = table;
69
+ while (table_size > 0) {
70
+ int step = table_size / 2;
71
+ const int *it = table + step;
72
+ if (value >= *it) {
73
+ table = it + 1;
74
+ table_size -= step + 1;
75
+ } else {
76
+ table_size = step;
77
+ }
78
+ }
79
+ return (int)(table - start) - 1;
80
+ }
81
+
82
+ size_t grpc_stats_histo_count(const grpc_stats_data *stats,
83
+ grpc_stats_histograms histogram) {
84
+ size_t sum = 0;
85
+ for (int i = 0; i < grpc_stats_histo_buckets[histogram]; i++) {
86
+ sum += (size_t)stats->histograms[grpc_stats_histo_start[histogram] + i];
87
+ }
88
+ return sum;
89
+ }
90
+
91
+ static double threshold_for_count_below(const gpr_atm *bucket_counts,
92
+ const int *bucket_boundaries,
93
+ int num_buckets, double count_below) {
94
+ double count_so_far;
95
+ double lower_bound;
96
+ double upper_bound;
97
+ int lower_idx;
98
+ int upper_idx;
99
+
100
+ /* find the lowest bucket that gets us above count_below */
101
+ count_so_far = 0.0;
102
+ for (lower_idx = 0; lower_idx < num_buckets; lower_idx++) {
103
+ count_so_far += (double)bucket_counts[lower_idx];
104
+ if (count_so_far >= count_below) {
105
+ break;
106
+ }
107
+ }
108
+ if (count_so_far == count_below) {
109
+ /* this bucket hits the threshold exactly... we should be midway through
110
+ any run of zero values following the bucket */
111
+ for (upper_idx = lower_idx + 1; upper_idx < num_buckets; upper_idx++) {
112
+ if (bucket_counts[upper_idx]) {
113
+ break;
114
+ }
115
+ }
116
+ return (bucket_boundaries[lower_idx] + bucket_boundaries[upper_idx]) / 2.0;
117
+ } else {
118
+ /* treat values as uniform throughout the bucket, and find where this value
119
+ should lie */
120
+ lower_bound = bucket_boundaries[lower_idx];
121
+ upper_bound = bucket_boundaries[lower_idx + 1];
122
+ return upper_bound -
123
+ (upper_bound - lower_bound) * (count_so_far - count_below) /
124
+ (double)bucket_counts[lower_idx];
125
+ }
126
+ }
127
+
128
+ double grpc_stats_histo_percentile(const grpc_stats_data *stats,
129
+ grpc_stats_histograms histogram,
130
+ double percentile) {
131
+ size_t count = grpc_stats_histo_count(stats, histogram);
132
+ if (count == 0) return 0.0;
133
+ return threshold_for_count_below(
134
+ stats->histograms + grpc_stats_histo_start[histogram],
135
+ grpc_stats_histo_bucket_boundaries[histogram],
136
+ grpc_stats_histo_buckets[histogram], (double)count * percentile / 100.0);
137
+ }
138
+
139
+ char *grpc_stats_data_as_json(const grpc_stats_data *data) {
140
+ gpr_strvec v;
141
+ char *tmp;
142
+ bool is_first = true;
143
+ gpr_strvec_init(&v);
144
+ gpr_strvec_add(&v, gpr_strdup("{"));
145
+ for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
146
+ gpr_asprintf(&tmp, "%s\"%s\": %" PRIdPTR, is_first ? "" : ", ",
147
+ grpc_stats_counter_name[i], data->counters[i]);
148
+ gpr_strvec_add(&v, tmp);
149
+ is_first = false;
150
+ }
151
+ for (size_t i = 0; i < GRPC_STATS_HISTOGRAM_COUNT; i++) {
152
+ gpr_asprintf(&tmp, "%s\"%s\": [", is_first ? "" : ", ",
153
+ grpc_stats_histogram_name[i]);
154
+ gpr_strvec_add(&v, tmp);
155
+ for (int j = 0; j < grpc_stats_histo_buckets[i]; j++) {
156
+ gpr_asprintf(&tmp, "%s%" PRIdPTR, j == 0 ? "" : ",",
157
+ data->histograms[grpc_stats_histo_start[i] + j]);
158
+ gpr_strvec_add(&v, tmp);
159
+ }
160
+ gpr_asprintf(&tmp, "], \"%s_bkt\": [", grpc_stats_histogram_name[i]);
161
+ gpr_strvec_add(&v, tmp);
162
+ for (int j = 0; j < grpc_stats_histo_buckets[i]; j++) {
163
+ gpr_asprintf(&tmp, "%s%d", j == 0 ? "" : ",",
164
+ grpc_stats_histo_bucket_boundaries[i][j]);
165
+ gpr_strvec_add(&v, tmp);
166
+ }
167
+ gpr_strvec_add(&v, gpr_strdup("]"));
168
+ is_first = false;
169
+ }
170
+ gpr_strvec_add(&v, gpr_strdup("}"));
171
+ tmp = gpr_strvec_flatten(&v, NULL);
172
+ gpr_strvec_destroy(&v);
173
+ return tmp;
174
+ }
@@ -0,0 +1,61 @@
1
+ /*
2
+ *
3
+ * Copyright 2017 gRPC authors.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ #ifndef GRPC_CORE_LIB_DEBUG_STATS_H
20
+ #define GRPC_CORE_LIB_DEBUG_STATS_H
21
+
22
+ #include <grpc/support/atm.h>
23
+ #include "src/core/lib/debug/stats_data.h"
24
+ #include "src/core/lib/iomgr/exec_ctx.h"
25
+
26
+ typedef struct grpc_stats_data {
27
+ gpr_atm counters[GRPC_STATS_COUNTER_COUNT];
28
+ gpr_atm histograms[GRPC_STATS_HISTOGRAM_BUCKETS];
29
+ } grpc_stats_data;
30
+
31
+ extern grpc_stats_data *grpc_stats_per_cpu_storage;
32
+
33
+ #define GRPC_THREAD_STATS_DATA(exec_ctx) \
34
+ (&grpc_stats_per_cpu_storage[(exec_ctx)->starting_cpu])
35
+
36
+ #define GRPC_STATS_INC_COUNTER(exec_ctx, ctr) \
37
+ (gpr_atm_no_barrier_fetch_add( \
38
+ &GRPC_THREAD_STATS_DATA((exec_ctx))->counters[(ctr)], 1))
39
+
40
+ #define GRPC_STATS_INC_HISTOGRAM(exec_ctx, histogram, index) \
41
+ (gpr_atm_no_barrier_fetch_add( \
42
+ &GRPC_THREAD_STATS_DATA((exec_ctx)) \
43
+ ->histograms[histogram##_FIRST_SLOT + (index)], \
44
+ 1))
45
+
46
+ void grpc_stats_init(void);
47
+ void grpc_stats_shutdown(void);
48
+ void grpc_stats_collect(grpc_stats_data *output);
49
+ // c = b-a
50
+ void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a,
51
+ grpc_stats_data *c);
52
+ char *grpc_stats_data_as_json(const grpc_stats_data *data);
53
+ int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value,
54
+ const int *table, int table_size);
55
+ double grpc_stats_histo_percentile(const grpc_stats_data *data,
56
+ grpc_stats_histograms histogram,
57
+ double percentile);
58
+ size_t grpc_stats_histo_count(const grpc_stats_data *data,
59
+ grpc_stats_histograms histogram);
60
+
61
+ #endif
@@ -0,0 +1,687 @@
1
+ /*
2
+ * Copyright 2017 gRPC authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /*
18
+ * Automatically generated by tools/codegen/core/gen_stats_data.py
19
+ */
20
+
21
+ #include "src/core/lib/debug/stats_data.h"
22
+ #include <grpc/support/useful.h>
23
+ #include "src/core/lib/debug/stats.h"
24
+ #include "src/core/lib/iomgr/exec_ctx.h"
25
+ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = {
26
+ "client_calls_created",
27
+ "server_calls_created",
28
+ "cqs_created",
29
+ "client_channels_created",
30
+ "client_subchannels_created",
31
+ "server_channels_created",
32
+ "syscall_poll",
33
+ "syscall_wait",
34
+ "pollset_kick",
35
+ "pollset_kicked_without_poller",
36
+ "pollset_kicked_again",
37
+ "pollset_kick_wakeup_fd",
38
+ "pollset_kick_wakeup_cv",
39
+ "pollset_kick_own_thread",
40
+ "histogram_slow_lookups",
41
+ "syscall_write",
42
+ "syscall_read",
43
+ "tcp_backup_pollers_created",
44
+ "tcp_backup_poller_polls",
45
+ "http2_op_batches",
46
+ "http2_op_cancel",
47
+ "http2_op_send_initial_metadata",
48
+ "http2_op_send_message",
49
+ "http2_op_send_trailing_metadata",
50
+ "http2_op_recv_initial_metadata",
51
+ "http2_op_recv_message",
52
+ "http2_op_recv_trailing_metadata",
53
+ "http2_settings_writes",
54
+ "http2_pings_sent",
55
+ "http2_writes_begun",
56
+ "http2_writes_offloaded",
57
+ "http2_writes_continued",
58
+ "http2_partial_writes",
59
+ "http2_initiate_write_due_to_initial_write",
60
+ "http2_initiate_write_due_to_start_new_stream",
61
+ "http2_initiate_write_due_to_send_message",
62
+ "http2_initiate_write_due_to_send_initial_metadata",
63
+ "http2_initiate_write_due_to_send_trailing_metadata",
64
+ "http2_initiate_write_due_to_retry_send_ping",
65
+ "http2_initiate_write_due_to_continue_pings",
66
+ "http2_initiate_write_due_to_goaway_sent",
67
+ "http2_initiate_write_due_to_rst_stream",
68
+ "http2_initiate_write_due_to_close_from_api",
69
+ "http2_initiate_write_due_to_stream_flow_control",
70
+ "http2_initiate_write_due_to_transport_flow_control",
71
+ "http2_initiate_write_due_to_send_settings",
72
+ "http2_initiate_write_due_to_bdp_estimator_ping",
73
+ "http2_initiate_write_due_to_flow_control_unstalled_by_setting",
74
+ "http2_initiate_write_due_to_flow_control_unstalled_by_update",
75
+ "http2_initiate_write_due_to_application_ping",
76
+ "http2_initiate_write_due_to_keepalive_ping",
77
+ "http2_initiate_write_due_to_transport_flow_control_unstalled",
78
+ "http2_initiate_write_due_to_ping_response",
79
+ "http2_initiate_write_due_to_force_rst_stream",
80
+ "hpack_recv_indexed",
81
+ "hpack_recv_lithdr_incidx",
82
+ "hpack_recv_lithdr_incidx_v",
83
+ "hpack_recv_lithdr_notidx",
84
+ "hpack_recv_lithdr_notidx_v",
85
+ "hpack_recv_lithdr_nvridx",
86
+ "hpack_recv_lithdr_nvridx_v",
87
+ "hpack_recv_uncompressed",
88
+ "hpack_recv_huffman",
89
+ "hpack_recv_binary",
90
+ "hpack_recv_binary_base64",
91
+ "hpack_send_indexed",
92
+ "hpack_send_lithdr_incidx",
93
+ "hpack_send_lithdr_incidx_v",
94
+ "hpack_send_lithdr_notidx",
95
+ "hpack_send_lithdr_notidx_v",
96
+ "hpack_send_lithdr_nvridx",
97
+ "hpack_send_lithdr_nvridx_v",
98
+ "hpack_send_uncompressed",
99
+ "hpack_send_huffman",
100
+ "hpack_send_binary",
101
+ "hpack_send_binary_base64",
102
+ "combiner_locks_initiated",
103
+ "combiner_locks_scheduled_items",
104
+ "combiner_locks_scheduled_final_items",
105
+ "combiner_locks_offloaded",
106
+ "executor_scheduled_short_items",
107
+ "executor_scheduled_long_items",
108
+ "executor_scheduled_to_self",
109
+ "executor_wakeup_initiated",
110
+ "executor_queue_drained",
111
+ "executor_push_retries",
112
+ "server_requested_calls",
113
+ "server_slowpath_requests_queued",
114
+ };
115
+ const char *grpc_stats_counter_doc[GRPC_STATS_COUNTER_COUNT] = {
116
+ "Number of client side calls created by this process",
117
+ "Number of server side calls created by this process",
118
+ "Number of completion queues created", "Number of client channels created",
119
+ "Number of client subchannels created", "Number of server channels created",
120
+ "Number of polling syscalls (epoll_wait, poll, etc) made by this process",
121
+ "Number of sleeping syscalls made by this process",
122
+ "How many polling wakeups were performed by the process (only valid for "
123
+ "epoll1 right now)",
124
+ "How many times was a polling wakeup requested without an active poller "
125
+ "(only valid for epoll1 right now)",
126
+ "How many times was the same polling worker awoken repeatedly before "
127
+ "waking up (only valid for epoll1 right now)",
128
+ "How many times was an eventfd used as the wakeup vector for a polling "
129
+ "wakeup (only valid for epoll1 right now)",
130
+ "How many times was a condition variable used as the wakeup vector for a "
131
+ "polling wakeup (only valid for epoll1 right now)",
132
+ "How many times could a polling wakeup be satisfied by keeping the waking "
133
+ "thread awake? (only valid for epoll1 right now)",
134
+ "Number of times histogram increments went through the slow (binary "
135
+ "search) path",
136
+ "Number of write syscalls (or equivalent - eg sendmsg) made by this "
137
+ "process",
138
+ "Number of read syscalls (or equivalent - eg recvmsg) made by this process",
139
+ "Number of times a backup poller has been created (this can be expensive)",
140
+ "Number of polls performed on the backup poller",
141
+ "Number of batches received by HTTP2 transport",
142
+ "Number of cancelations received by HTTP2 transport",
143
+ "Number of batches containing send initial metadata",
144
+ "Number of batches containing send message",
145
+ "Number of batches containing send trailing metadata",
146
+ "Number of batches containing receive initial metadata",
147
+ "Number of batches containing receive message",
148
+ "Number of batches containing receive trailing metadata",
149
+ "Number of settings frames sent", "Number of HTTP2 pings sent by process",
150
+ "Number of HTTP2 writes initiated",
151
+ "Number of HTTP2 writes offloaded to the executor from application threads",
152
+ "Number of HTTP2 writes that finished seeing more data needed to be "
153
+ "written",
154
+ "Number of HTTP2 writes that were made knowing there was still more data "
155
+ "to be written (we cap maximum write size to syscall_write)",
156
+ "Number of HTTP2 writes initiated due to 'initial_write'",
157
+ "Number of HTTP2 writes initiated due to 'start_new_stream'",
158
+ "Number of HTTP2 writes initiated due to 'send_message'",
159
+ "Number of HTTP2 writes initiated due to 'send_initial_metadata'",
160
+ "Number of HTTP2 writes initiated due to 'send_trailing_metadata'",
161
+ "Number of HTTP2 writes initiated due to 'retry_send_ping'",
162
+ "Number of HTTP2 writes initiated due to 'continue_pings'",
163
+ "Number of HTTP2 writes initiated due to 'goaway_sent'",
164
+ "Number of HTTP2 writes initiated due to 'rst_stream'",
165
+ "Number of HTTP2 writes initiated due to 'close_from_api'",
166
+ "Number of HTTP2 writes initiated due to 'stream_flow_control'",
167
+ "Number of HTTP2 writes initiated due to 'transport_flow_control'",
168
+ "Number of HTTP2 writes initiated due to 'send_settings'",
169
+ "Number of HTTP2 writes initiated due to 'bdp_estimator_ping'",
170
+ "Number of HTTP2 writes initiated due to "
171
+ "'flow_control_unstalled_by_setting'",
172
+ "Number of HTTP2 writes initiated due to "
173
+ "'flow_control_unstalled_by_update'",
174
+ "Number of HTTP2 writes initiated due to 'application_ping'",
175
+ "Number of HTTP2 writes initiated due to 'keepalive_ping'",
176
+ "Number of HTTP2 writes initiated due to "
177
+ "'transport_flow_control_unstalled'",
178
+ "Number of HTTP2 writes initiated due to 'ping_response'",
179
+ "Number of HTTP2 writes initiated due to 'force_rst_stream'",
180
+ "Number of HPACK indexed fields received",
181
+ "Number of HPACK literal headers received with incremental indexing",
182
+ "Number of HPACK literal headers received with incremental indexing and "
183
+ "literal keys",
184
+ "Number of HPACK literal headers received with no indexing",
185
+ "Number of HPACK literal headers received with no indexing and literal "
186
+ "keys",
187
+ "Number of HPACK literal headers received with never-indexing",
188
+ "Number of HPACK literal headers received with never-indexing and literal "
189
+ "keys",
190
+ "Number of uncompressed strings received in metadata",
191
+ "Number of huffman encoded strings received in metadata",
192
+ "Number of binary strings received in metadata",
193
+ "Number of binary strings received encoded in base64 in metadata",
194
+ "Number of HPACK indexed fields sent",
195
+ "Number of HPACK literal headers sent with incremental indexing",
196
+ "Number of HPACK literal headers sent with incremental indexing and "
197
+ "literal keys",
198
+ "Number of HPACK literal headers sent with no indexing",
199
+ "Number of HPACK literal headers sent with no indexing and literal keys",
200
+ "Number of HPACK literal headers sent with never-indexing",
201
+ "Number of HPACK literal headers sent with never-indexing and literal keys",
202
+ "Number of uncompressed strings sent in metadata",
203
+ "Number of huffman encoded strings sent in metadata",
204
+ "Number of binary strings received in metadata",
205
+ "Number of binary strings received encoded in base64 in metadata",
206
+ "Number of combiner lock entries by process (first items queued to a "
207
+ "combiner)",
208
+ "Number of items scheduled against combiner locks",
209
+ "Number of final items scheduled against combiner locks",
210
+ "Number of combiner locks offloaded to different threads",
211
+ "Number of finite runtime closures scheduled against the executor (gRPC "
212
+ "thread pool)",
213
+ "Number of potentially infinite runtime closures scheduled against the "
214
+ "executor (gRPC thread pool)",
215
+ "Number of closures scheduled by the executor to the executor",
216
+ "Number of thread wakeups initiated within the executor",
217
+ "Number of times an executor queue was drained",
218
+ "Number of times we raced and were forced to retry pushing a closure to "
219
+ "the executor",
220
+ "How many calls were requested (not necessarily received) by the server",
221
+ "How many times was the server slow path taken (indicates too few "
222
+ "outstanding requests)",
223
+ };
224
+ const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = {
225
+ "call_initial_size",
226
+ "poll_events_returned",
227
+ "tcp_write_size",
228
+ "tcp_write_iov_size",
229
+ "tcp_read_size",
230
+ "tcp_read_offer",
231
+ "tcp_read_offer_iov_size",
232
+ "http2_send_message_size",
233
+ "http2_send_initial_metadata_per_write",
234
+ "http2_send_message_per_write",
235
+ "http2_send_trailing_metadata_per_write",
236
+ "http2_send_flowctl_per_write",
237
+ "server_cqs_checked",
238
+ };
239
+ const char *grpc_stats_histogram_doc[GRPC_STATS_HISTOGRAM_COUNT] = {
240
+ "Initial size of the grpc_call arena created at call start",
241
+ "How many events are called for each syscall_poll",
242
+ "Number of bytes offered to each syscall_write",
243
+ "Number of byte segments offered to each syscall_write",
244
+ "Number of bytes received by each syscall_read",
245
+ "Number of bytes offered to each syscall_read",
246
+ "Number of byte segments offered to each syscall_read",
247
+ "Size of messages received by HTTP2 transport",
248
+ "Number of streams initiated written per TCP write",
249
+ "Number of streams whose payload was written per TCP write",
250
+ "Number of streams terminated per TCP write",
251
+ "Number of flow control updates written per TCP write",
252
+ "How many completion queues were checked looking for a CQ that had "
253
+ "requested the incoming call",
254
+ };
255
+ const int grpc_stats_table_0[65] = {
256
+ 0, 1, 2, 3, 4, 5, 7, 9, 11, 14,
257
+ 17, 21, 26, 32, 39, 47, 57, 68, 82, 98,
258
+ 117, 140, 167, 199, 238, 284, 339, 404, 482, 575,
259
+ 685, 816, 972, 1158, 1380, 1644, 1959, 2334, 2780, 3312,
260
+ 3945, 4699, 5597, 6667, 7941, 9459, 11267, 13420, 15984, 19038,
261
+ 22676, 27009, 32169, 38315, 45635, 54353, 64737, 77104, 91834, 109378,
262
+ 130273, 155159, 184799, 220100, 262144};
263
+ const uint8_t grpc_stats_table_1[124] = {
264
+ 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6,
265
+ 7, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15,
266
+ 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 24,
267
+ 24, 25, 25, 26, 26, 26, 27, 27, 28, 29, 29, 30, 30, 30, 31, 31, 32, 33,
268
+ 33, 34, 34, 34, 35, 35, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,
269
+ 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50,
270
+ 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58};
271
+ const int grpc_stats_table_2[129] = {
272
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
273
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30,
274
+ 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60,
275
+ 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 94, 98, 102, 106, 110,
276
+ 114, 118, 122, 126, 131, 136, 141, 146, 151, 156, 162, 168, 174, 180, 186,
277
+ 192, 199, 206, 213, 220, 228, 236, 244, 252, 260, 269, 278, 287, 297, 307,
278
+ 317, 327, 338, 349, 360, 372, 384, 396, 409, 422, 436, 450, 464, 479, 494,
279
+ 510, 526, 543, 560, 578, 596, 615, 634, 654, 674, 695, 717, 739, 762, 785,
280
+ 809, 834, 859, 885, 912, 939, 967, 996, 1024};
281
+ const uint8_t grpc_stats_table_3[166] = {
282
+ 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
283
+ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16,
284
+ 17, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28,
285
+ 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 36, 36, 37, 38, 39,
286
+ 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51,
287
+ 51, 52, 52, 53, 53, 54, 54, 55, 56, 57, 58, 59, 59, 60, 61, 62, 63, 63, 64,
288
+ 65, 65, 66, 67, 67, 68, 69, 69, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76,
289
+ 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 88, 88, 89, 90, 90,
290
+ 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 98, 99};
291
+ const int grpc_stats_table_4[65] = {
292
+ 0, 1, 2, 3, 4, 6, 8, 11,
293
+ 15, 20, 26, 34, 44, 57, 73, 94,
294
+ 121, 155, 199, 255, 327, 419, 537, 688,
295
+ 881, 1128, 1444, 1848, 2365, 3026, 3872, 4954,
296
+ 6338, 8108, 10373, 13270, 16976, 21717, 27782, 35541,
297
+ 45467, 58165, 74409, 95189, 121772, 155778, 199281, 254933,
298
+ 326126, 417200, 533707, 682750, 873414, 1117323, 1429345, 1828502,
299
+ 2339127, 2992348, 3827987, 4896985, 6264509, 8013925, 10251880, 13114801,
300
+ 16777216};
301
+ const uint8_t grpc_stats_table_5[87] = {
302
+ 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 11,
303
+ 11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23,
304
+ 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36,
305
+ 36, 37, 38, 39, 39, 40, 41, 41, 42, 43, 44, 44, 45, 45, 46, 47, 48, 48,
306
+ 49, 50, 51, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, 59};
307
+ const int grpc_stats_table_6[65] = {
308
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
309
+ 14, 16, 18, 20, 22, 24, 27, 30, 33, 36, 39, 43, 47,
310
+ 51, 56, 61, 66, 72, 78, 85, 92, 100, 109, 118, 128, 139,
311
+ 151, 164, 178, 193, 209, 226, 244, 264, 285, 308, 333, 359, 387,
312
+ 418, 451, 486, 524, 565, 609, 656, 707, 762, 821, 884, 952, 1024};
313
+ const uint8_t grpc_stats_table_7[102] = {
314
+ 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
315
+ 6, 7, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14,
316
+ 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23,
317
+ 23, 24, 24, 24, 25, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32,
318
+ 32, 33, 33, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41,
319
+ 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 49, 50, 50, 51, 51};
320
+ const int grpc_stats_table_8[9] = {0, 1, 2, 4, 7, 13, 23, 39, 64};
321
+ const uint8_t grpc_stats_table_9[9] = {0, 0, 1, 2, 2, 3, 4, 4, 5};
322
+ void grpc_stats_inc_call_initial_size(grpc_exec_ctx *exec_ctx, int value) {
323
+ value = GPR_CLAMP(value, 0, 262144);
324
+ if (value < 6) {
325
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE,
326
+ value);
327
+ return;
328
+ }
329
+ union {
330
+ double dbl;
331
+ uint64_t uint;
332
+ } _val, _bkt;
333
+ _val.dbl = value;
334
+ if (_val.uint < 4651092515166879744ull) {
335
+ int bucket =
336
+ grpc_stats_table_1[((_val.uint - 4618441417868443648ull) >> 49)] + 6;
337
+ _bkt.dbl = grpc_stats_table_0[bucket];
338
+ bucket -= (_val.uint < _bkt.uint);
339
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE,
340
+ bucket);
341
+ return;
342
+ }
343
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_CALL_INITIAL_SIZE,
344
+ grpc_stats_histo_find_bucket_slow(
345
+ (exec_ctx), value, grpc_stats_table_0, 64));
346
+ }
347
+ void grpc_stats_inc_poll_events_returned(grpc_exec_ctx *exec_ctx, int value) {
348
+ value = GPR_CLAMP(value, 0, 1024);
349
+ if (value < 29) {
350
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
351
+ GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, value);
352
+ return;
353
+ }
354
+ union {
355
+ double dbl;
356
+ uint64_t uint;
357
+ } _val, _bkt;
358
+ _val.dbl = value;
359
+ if (_val.uint < 4642789003353915392ull) {
360
+ int bucket =
361
+ grpc_stats_table_3[((_val.uint - 4628855992006737920ull) >> 47)] + 29;
362
+ _bkt.dbl = grpc_stats_table_2[bucket];
363
+ bucket -= (_val.uint < _bkt.uint);
364
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
365
+ GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED, bucket);
366
+ return;
367
+ }
368
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
369
+ GRPC_STATS_HISTOGRAM_POLL_EVENTS_RETURNED,
370
+ grpc_stats_histo_find_bucket_slow(
371
+ (exec_ctx), value, grpc_stats_table_2, 128));
372
+ }
373
+ void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int value) {
374
+ value = GPR_CLAMP(value, 0, 16777216);
375
+ if (value < 5) {
376
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE,
377
+ value);
378
+ return;
379
+ }
380
+ union {
381
+ double dbl;
382
+ uint64_t uint;
383
+ } _val, _bkt;
384
+ _val.dbl = value;
385
+ if (_val.uint < 4683743612465315840ull) {
386
+ int bucket =
387
+ grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)] + 5;
388
+ _bkt.dbl = grpc_stats_table_4[bucket];
389
+ bucket -= (_val.uint < _bkt.uint);
390
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE,
391
+ bucket);
392
+ return;
393
+ }
394
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_SIZE,
395
+ grpc_stats_histo_find_bucket_slow(
396
+ (exec_ctx), value, grpc_stats_table_4, 64));
397
+ }
398
+ void grpc_stats_inc_tcp_write_iov_size(grpc_exec_ctx *exec_ctx, int value) {
399
+ value = GPR_CLAMP(value, 0, 1024);
400
+ if (value < 13) {
401
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
402
+ GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, value);
403
+ return;
404
+ }
405
+ union {
406
+ double dbl;
407
+ uint64_t uint;
408
+ } _val, _bkt;
409
+ _val.dbl = value;
410
+ if (_val.uint < 4637863191261478912ull) {
411
+ int bucket =
412
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
413
+ _bkt.dbl = grpc_stats_table_6[bucket];
414
+ bucket -= (_val.uint < _bkt.uint);
415
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
416
+ GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE, bucket);
417
+ return;
418
+ }
419
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_WRITE_IOV_SIZE,
420
+ grpc_stats_histo_find_bucket_slow(
421
+ (exec_ctx), value, grpc_stats_table_6, 64));
422
+ }
423
+ void grpc_stats_inc_tcp_read_size(grpc_exec_ctx *exec_ctx, int value) {
424
+ value = GPR_CLAMP(value, 0, 16777216);
425
+ if (value < 5) {
426
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE,
427
+ value);
428
+ return;
429
+ }
430
+ union {
431
+ double dbl;
432
+ uint64_t uint;
433
+ } _val, _bkt;
434
+ _val.dbl = value;
435
+ if (_val.uint < 4683743612465315840ull) {
436
+ int bucket =
437
+ grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)] + 5;
438
+ _bkt.dbl = grpc_stats_table_4[bucket];
439
+ bucket -= (_val.uint < _bkt.uint);
440
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE,
441
+ bucket);
442
+ return;
443
+ }
444
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_SIZE,
445
+ grpc_stats_histo_find_bucket_slow(
446
+ (exec_ctx), value, grpc_stats_table_4, 64));
447
+ }
448
+ void grpc_stats_inc_tcp_read_offer(grpc_exec_ctx *exec_ctx, int value) {
449
+ value = GPR_CLAMP(value, 0, 16777216);
450
+ if (value < 5) {
451
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER,
452
+ value);
453
+ return;
454
+ }
455
+ union {
456
+ double dbl;
457
+ uint64_t uint;
458
+ } _val, _bkt;
459
+ _val.dbl = value;
460
+ if (_val.uint < 4683743612465315840ull) {
461
+ int bucket =
462
+ grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)] + 5;
463
+ _bkt.dbl = grpc_stats_table_4[bucket];
464
+ bucket -= (_val.uint < _bkt.uint);
465
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER,
466
+ bucket);
467
+ return;
468
+ }
469
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER,
470
+ grpc_stats_histo_find_bucket_slow(
471
+ (exec_ctx), value, grpc_stats_table_4, 64));
472
+ }
473
+ void grpc_stats_inc_tcp_read_offer_iov_size(grpc_exec_ctx *exec_ctx,
474
+ int value) {
475
+ value = GPR_CLAMP(value, 0, 1024);
476
+ if (value < 13) {
477
+ GRPC_STATS_INC_HISTOGRAM(
478
+ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_IOV_SIZE, value);
479
+ return;
480
+ }
481
+ union {
482
+ double dbl;
483
+ uint64_t uint;
484
+ } _val, _bkt;
485
+ _val.dbl = value;
486
+ if (_val.uint < 4637863191261478912ull) {
487
+ int bucket =
488
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
489
+ _bkt.dbl = grpc_stats_table_6[bucket];
490
+ bucket -= (_val.uint < _bkt.uint);
491
+ GRPC_STATS_INC_HISTOGRAM(
492
+ (exec_ctx), GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_IOV_SIZE, bucket);
493
+ return;
494
+ }
495
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
496
+ GRPC_STATS_HISTOGRAM_TCP_READ_OFFER_IOV_SIZE,
497
+ grpc_stats_histo_find_bucket_slow(
498
+ (exec_ctx), value, grpc_stats_table_6, 64));
499
+ }
500
+ void grpc_stats_inc_http2_send_message_size(grpc_exec_ctx *exec_ctx,
501
+ int value) {
502
+ value = GPR_CLAMP(value, 0, 16777216);
503
+ if (value < 5) {
504
+ GRPC_STATS_INC_HISTOGRAM(
505
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE, value);
506
+ return;
507
+ }
508
+ union {
509
+ double dbl;
510
+ uint64_t uint;
511
+ } _val, _bkt;
512
+ _val.dbl = value;
513
+ if (_val.uint < 4683743612465315840ull) {
514
+ int bucket =
515
+ grpc_stats_table_5[((_val.uint - 4617315517961601024ull) >> 50)] + 5;
516
+ _bkt.dbl = grpc_stats_table_4[bucket];
517
+ bucket -= (_val.uint < _bkt.uint);
518
+ GRPC_STATS_INC_HISTOGRAM(
519
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE, bucket);
520
+ return;
521
+ }
522
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
523
+ GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_SIZE,
524
+ grpc_stats_histo_find_bucket_slow(
525
+ (exec_ctx), value, grpc_stats_table_4, 64));
526
+ }
527
+ void grpc_stats_inc_http2_send_initial_metadata_per_write(
528
+ grpc_exec_ctx *exec_ctx, int value) {
529
+ value = GPR_CLAMP(value, 0, 1024);
530
+ if (value < 13) {
531
+ GRPC_STATS_INC_HISTOGRAM(
532
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_INITIAL_METADATA_PER_WRITE,
533
+ value);
534
+ return;
535
+ }
536
+ union {
537
+ double dbl;
538
+ uint64_t uint;
539
+ } _val, _bkt;
540
+ _val.dbl = value;
541
+ if (_val.uint < 4637863191261478912ull) {
542
+ int bucket =
543
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
544
+ _bkt.dbl = grpc_stats_table_6[bucket];
545
+ bucket -= (_val.uint < _bkt.uint);
546
+ GRPC_STATS_INC_HISTOGRAM(
547
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_INITIAL_METADATA_PER_WRITE,
548
+ bucket);
549
+ return;
550
+ }
551
+ GRPC_STATS_INC_HISTOGRAM(
552
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_INITIAL_METADATA_PER_WRITE,
553
+ grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_6,
554
+ 64));
555
+ }
556
+ void grpc_stats_inc_http2_send_message_per_write(grpc_exec_ctx *exec_ctx,
557
+ int value) {
558
+ value = GPR_CLAMP(value, 0, 1024);
559
+ if (value < 13) {
560
+ GRPC_STATS_INC_HISTOGRAM(
561
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_PER_WRITE, value);
562
+ return;
563
+ }
564
+ union {
565
+ double dbl;
566
+ uint64_t uint;
567
+ } _val, _bkt;
568
+ _val.dbl = value;
569
+ if (_val.uint < 4637863191261478912ull) {
570
+ int bucket =
571
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
572
+ _bkt.dbl = grpc_stats_table_6[bucket];
573
+ bucket -= (_val.uint < _bkt.uint);
574
+ GRPC_STATS_INC_HISTOGRAM(
575
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_PER_WRITE, bucket);
576
+ return;
577
+ }
578
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
579
+ GRPC_STATS_HISTOGRAM_HTTP2_SEND_MESSAGE_PER_WRITE,
580
+ grpc_stats_histo_find_bucket_slow(
581
+ (exec_ctx), value, grpc_stats_table_6, 64));
582
+ }
583
+ void grpc_stats_inc_http2_send_trailing_metadata_per_write(
584
+ grpc_exec_ctx *exec_ctx, int value) {
585
+ value = GPR_CLAMP(value, 0, 1024);
586
+ if (value < 13) {
587
+ GRPC_STATS_INC_HISTOGRAM(
588
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_TRAILING_METADATA_PER_WRITE,
589
+ value);
590
+ return;
591
+ }
592
+ union {
593
+ double dbl;
594
+ uint64_t uint;
595
+ } _val, _bkt;
596
+ _val.dbl = value;
597
+ if (_val.uint < 4637863191261478912ull) {
598
+ int bucket =
599
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
600
+ _bkt.dbl = grpc_stats_table_6[bucket];
601
+ bucket -= (_val.uint < _bkt.uint);
602
+ GRPC_STATS_INC_HISTOGRAM(
603
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_TRAILING_METADATA_PER_WRITE,
604
+ bucket);
605
+ return;
606
+ }
607
+ GRPC_STATS_INC_HISTOGRAM(
608
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_TRAILING_METADATA_PER_WRITE,
609
+ grpc_stats_histo_find_bucket_slow((exec_ctx), value, grpc_stats_table_6,
610
+ 64));
611
+ }
612
+ void grpc_stats_inc_http2_send_flowctl_per_write(grpc_exec_ctx *exec_ctx,
613
+ int value) {
614
+ value = GPR_CLAMP(value, 0, 1024);
615
+ if (value < 13) {
616
+ GRPC_STATS_INC_HISTOGRAM(
617
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE, value);
618
+ return;
619
+ }
620
+ union {
621
+ double dbl;
622
+ uint64_t uint;
623
+ } _val, _bkt;
624
+ _val.dbl = value;
625
+ if (_val.uint < 4637863191261478912ull) {
626
+ int bucket =
627
+ grpc_stats_table_7[((_val.uint - 4623507967449235456ull) >> 48)] + 13;
628
+ _bkt.dbl = grpc_stats_table_6[bucket];
629
+ bucket -= (_val.uint < _bkt.uint);
630
+ GRPC_STATS_INC_HISTOGRAM(
631
+ (exec_ctx), GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE, bucket);
632
+ return;
633
+ }
634
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
635
+ GRPC_STATS_HISTOGRAM_HTTP2_SEND_FLOWCTL_PER_WRITE,
636
+ grpc_stats_histo_find_bucket_slow(
637
+ (exec_ctx), value, grpc_stats_table_6, 64));
638
+ }
639
+ void grpc_stats_inc_server_cqs_checked(grpc_exec_ctx *exec_ctx, int value) {
640
+ value = GPR_CLAMP(value, 0, 64);
641
+ if (value < 3) {
642
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
643
+ GRPC_STATS_HISTOGRAM_SERVER_CQS_CHECKED, value);
644
+ return;
645
+ }
646
+ union {
647
+ double dbl;
648
+ uint64_t uint;
649
+ } _val, _bkt;
650
+ _val.dbl = value;
651
+ if (_val.uint < 4625196817309499392ull) {
652
+ int bucket =
653
+ grpc_stats_table_9[((_val.uint - 4613937818241073152ull) >> 51)] + 3;
654
+ _bkt.dbl = grpc_stats_table_8[bucket];
655
+ bucket -= (_val.uint < _bkt.uint);
656
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx),
657
+ GRPC_STATS_HISTOGRAM_SERVER_CQS_CHECKED, bucket);
658
+ return;
659
+ }
660
+ GRPC_STATS_INC_HISTOGRAM((exec_ctx), GRPC_STATS_HISTOGRAM_SERVER_CQS_CHECKED,
661
+ grpc_stats_histo_find_bucket_slow(
662
+ (exec_ctx), value, grpc_stats_table_8, 8));
663
+ }
664
+ const int grpc_stats_histo_buckets[13] = {64, 128, 64, 64, 64, 64, 64,
665
+ 64, 64, 64, 64, 64, 8};
666
+ const int grpc_stats_histo_start[13] = {0, 64, 192, 256, 320, 384, 448,
667
+ 512, 576, 640, 704, 768, 832};
668
+ const int *const grpc_stats_histo_bucket_boundaries[13] = {
669
+ grpc_stats_table_0, grpc_stats_table_2, grpc_stats_table_4,
670
+ grpc_stats_table_6, grpc_stats_table_4, grpc_stats_table_4,
671
+ grpc_stats_table_6, grpc_stats_table_4, grpc_stats_table_6,
672
+ grpc_stats_table_6, grpc_stats_table_6, grpc_stats_table_6,
673
+ grpc_stats_table_8};
674
+ void (*const grpc_stats_inc_histogram[13])(grpc_exec_ctx *exec_ctx, int x) = {
675
+ grpc_stats_inc_call_initial_size,
676
+ grpc_stats_inc_poll_events_returned,
677
+ grpc_stats_inc_tcp_write_size,
678
+ grpc_stats_inc_tcp_write_iov_size,
679
+ grpc_stats_inc_tcp_read_size,
680
+ grpc_stats_inc_tcp_read_offer,
681
+ grpc_stats_inc_tcp_read_offer_iov_size,
682
+ grpc_stats_inc_http2_send_message_size,
683
+ grpc_stats_inc_http2_send_initial_metadata_per_write,
684
+ grpc_stats_inc_http2_send_message_per_write,
685
+ grpc_stats_inc_http2_send_trailing_metadata_per_write,
686
+ grpc_stats_inc_http2_send_flowctl_per_write,
687
+ grpc_stats_inc_server_cqs_checked};