Revert "Move arena into resource quota (#28008)" (#28292)

This reverts commit ad424a2ebf.
pull/28293/head
Craig Tiller 3 years ago committed by GitHub
parent 1ff1feaa83
commit 91edf92ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      BUILD
  2. 166
      CMakeLists.txt
  3. 3
      Makefile
  4. 314
      build_autogenerated.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 4
      gRPC-C++.podspec
  8. 6
      gRPC-Core.podspec
  9. 4
      grpc.gemspec
  10. 3
      grpc.gyp
  11. 4
      package.xml
  12. 2
      src/core/ext/filters/client_channel/backend_metric.h
  13. 2
      src/core/ext/filters/client_channel/config_selector.h
  14. 2
      src/core/ext/filters/client_channel/dynamic_filters.h
  15. 8
      src/core/ext/filters/client_channel/health/health_check_client.cc
  16. 5
      src/core/ext/filters/client_channel/health/health_check_client.h
  17. 2
      src/core/ext/filters/client_channel/subchannel.h
  18. 5
      src/core/ext/transport/binder/client/channel_create_impl.cc
  19. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  20. 2
      src/core/ext/transport/chttp2/transport/internal.h
  21. 2
      src/core/lib/channel/channel_stack.h
  22. 4
      src/core/lib/channel/channel_stack_builder.cc
  23. 2
      src/core/lib/channel/channel_stack_builder.h
  24. 29
      src/core/lib/gprpp/arena.cc
  25. 32
      src/core/lib/gprpp/arena.h
  26. 2
      src/core/lib/gprpp/chunked_vector.h
  27. 2
      src/core/lib/promise/arena_promise.h
  28. 1
      src/core/lib/resource_quota/api.h
  29. 2
      src/core/lib/security/context/security_context.cc
  30. 2
      src/core/lib/security/context/security_context.h
  31. 5
      src/core/lib/surface/call.cc
  32. 2
      src/core/lib/surface/call.h
  33. 20
      src/core/lib/surface/channel.cc
  34. 3
      src/core/lib/surface/channel.h
  35. 2
      src/core/lib/transport/transport.h
  36. 2
      src/python/grpcio/grpc_core_dependencies.py
  37. 6
      test/core/end2end/fixtures/h2_sockpair.cc
  38. 6
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  39. 3
      test/core/end2end/fuzzers/api_fuzzer.cc
  40. 9
      test/core/end2end/fuzzers/client_fuzzer.cc
  41. 4
      test/core/end2end/fuzzers/server_fuzzer.cc
  42. 13
      test/core/gpr/arena_test.cc
  43. 2
      test/core/gprpp/BUILD
  44. 7
      test/core/gprpp/chunked_vector_fuzzer.cc
  45. 15
      test/core/gprpp/chunked_vector_test.cc
  46. 1
      test/core/promise/BUILD
  47. 9
      test/core/promise/arena_promise_test.cc
  48. 20
      test/core/transport/binder/binder_transport_test.cc
  49. 10
      test/core/transport/binder/end2end/testing_channel_create.cc
  50. 5
      test/core/transport/binder/end2end/testing_channel_create.h
  51. 11
      test/core/transport/chttp2/hpack_encoder_test.cc
  52. 6
      test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
  53. 7
      test/core/transport/chttp2/hpack_parser_test.cc
  54. 14
      test/core/transport/metadata_map_test.cc
  55. 13
      test/core/transport/metadata_test.cc
  56. 5
      test/core/util/evaluate_args_test_util.h
  57. 15
      test/cpp/microbenchmarks/bm_arena.cc
  58. 31
      test/cpp/microbenchmarks/bm_call_create.cc
  59. 13
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  60. 14
      test/cpp/microbenchmarks/bm_chttp2_transport.cc
  61. 4
      tools/doxygen/Doxyfile.c++.internal
  62. 4
      tools/doxygen/Doxyfile.core.internal

21
BUILD

@ -609,7 +609,6 @@ grpc_cc_library(
"include/grpcpp/security/binder_credentials.h",
],
deps = [
"config",
"gpr",
"gpr_base",
"gpr_platform",
@ -806,6 +805,7 @@ grpc_cc_library(
"src/core/lib/gpr/tmpfile_posix.cc",
"src/core/lib/gpr/tmpfile_windows.cc",
"src/core/lib/gpr/wrap_memcpy.cc",
"src/core/lib/gprpp/arena.cc",
"src/core/lib/gprpp/examine_stack.cc",
"src/core/lib/gprpp/fork.cc",
"src/core/lib/gprpp/global_config_env.cc",
@ -829,6 +829,7 @@ grpc_cc_library(
"src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tmpfile.h",
"src/core/lib/gprpp/arena.h",
"src/core/lib/gprpp/examine_stack.h",
"src/core/lib/gprpp/fork.h",
"src/core/lib/gprpp/global_config.h",
@ -886,7 +887,6 @@ grpc_cc_library(
hdrs = ["src/core/lib/gprpp/chunked_vector.h"],
external_deps = ["absl/utility"],
deps = [
"arena",
# TODO(ctiller): weaken this to just arena when that splits into its own target
"gpr_base",
],
@ -1099,7 +1099,6 @@ grpc_cc_library(
"src/core/lib/promise/arena_promise.h",
],
deps = [
"arena",
"gpr_base",
"poll",
],
@ -1500,20 +1499,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "arena",
srcs = [
"src/core/lib/resource_quota/arena.cc",
],
hdrs = [
"src/core/lib/resource_quota/arena.h",
],
deps = [
"gpr_base",
"memory_quota",
],
)
grpc_cc_library(
name = "thread_quota",
srcs = [
@ -2056,7 +2041,6 @@ grpc_cc_library(
public_hdrs = GRPC_PUBLIC_HDRS + GRPC_PUBLIC_EVENT_ENGINE_HDRS,
visibility = ["@grpc:alt_grpc_base_legacy"],
deps = [
"arena",
"avl",
"bitset",
"channel_args",
@ -3407,7 +3391,6 @@ grpc_cc_library(
visibility = ["@grpc:public"],
deps = [
"alts_util",
"arena",
"config",
"error",
"gpr_base",

166
CMakeLists.txt generated

@ -1399,6 +1399,7 @@ add_library(gpr
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -1995,7 +1996,6 @@ add_library(grpc
src/core/lib/matchers/matchers.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/api.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
@ -2642,7 +2642,6 @@ add_library(grpc_unsecure
src/core/lib/json/json_writer.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/api.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
@ -7581,6 +7580,7 @@ add_executable(activity_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -7901,23 +7901,53 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(arena_promise_test
src/core/lib/debug/trace.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/iomgr/combiner.cc
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/exec_ctx.cc
src/core/lib/iomgr/executor.cc
src/core/lib/iomgr/iomgr_internal.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/slice/static_slice.cc
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/cpu_iphone.cc
src/core/lib/gpr/cpu_linux.cc
src/core/lib/gpr/cpu_posix.cc
src/core/lib/gpr/cpu_windows.cc
src/core/lib/gpr/env_linux.cc
src/core/lib/gpr/env_posix.cc
src/core/lib/gpr/env_windows.cc
src/core/lib/gpr/log.cc
src/core/lib/gpr/log_android.cc
src/core/lib/gpr/log_linux.cc
src/core/lib/gpr/log_posix.cc
src/core/lib/gpr/log_windows.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gpr/string.cc
src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
src/core/lib/gpr/time.cc
src/core/lib/gpr/time_posix.cc
src/core/lib/gpr/time_precise.cc
src/core/lib/gpr/time_windows.cc
src/core/lib/gpr/tmpfile_msys.cc
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
src/core/lib/gprpp/host_port.cc
src/core/lib/gprpp/mpscq.cc
src/core/lib/gprpp/stat_posix.cc
src/core/lib/gprpp/stat_windows.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/thd_posix.cc
src/core/lib/gprpp/thd_windows.cc
src/core/lib/gprpp/time_util.cc
src/core/lib/profiling/basic_timers.cc
src/core/lib/profiling/stap_timers.cc
test/core/promise/arena_promise_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -7945,9 +7975,19 @@ target_include_directories(arena_promise_test
target_link_libraries(arena_promise_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::statusor
absl::base
absl::core_headers
absl::memory
absl::random_random
absl::status
absl::cord
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::optional
absl::variant
gpr
upb
)
@ -9124,23 +9164,53 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(chunked_vector_test
src/core/lib/debug/trace.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/iomgr/combiner.cc
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/exec_ctx.cc
src/core/lib/iomgr/executor.cc
src/core/lib/iomgr/iomgr_internal.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/slice/static_slice.cc
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/cpu_iphone.cc
src/core/lib/gpr/cpu_linux.cc
src/core/lib/gpr/cpu_posix.cc
src/core/lib/gpr/cpu_windows.cc
src/core/lib/gpr/env_linux.cc
src/core/lib/gpr/env_posix.cc
src/core/lib/gpr/env_windows.cc
src/core/lib/gpr/log.cc
src/core/lib/gpr/log_android.cc
src/core/lib/gpr/log_linux.cc
src/core/lib/gpr/log_posix.cc
src/core/lib/gpr/log_windows.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gpr/string.cc
src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
src/core/lib/gpr/time.cc
src/core/lib/gpr/time_posix.cc
src/core/lib/gpr/time_precise.cc
src/core/lib/gpr/time_windows.cc
src/core/lib/gpr/tmpfile_msys.cc
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
src/core/lib/gprpp/host_port.cc
src/core/lib/gprpp/mpscq.cc
src/core/lib/gprpp/stat_posix.cc
src/core/lib/gprpp/stat_windows.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/thd_posix.cc
src/core/lib/gprpp/thd_windows.cc
src/core/lib/gprpp/time_util.cc
src/core/lib/profiling/basic_timers.cc
src/core/lib/profiling/stap_timers.cc
test/core/gprpp/chunked_vector_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -9168,10 +9238,19 @@ target_include_directories(chunked_vector_test
target_link_libraries(chunked_vector_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::statusor
absl::variant
absl::base
absl::core_headers
absl::memory
absl::random_random
absl::status
absl::cord
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::optional
absl::utility
gpr
upb
)
@ -9785,6 +9864,7 @@ add_executable(core_configuration_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -10841,6 +10921,7 @@ add_executable(for_each_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -12584,6 +12665,7 @@ add_executable(latch_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -13246,6 +13328,7 @@ add_executable(observable_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -13518,6 +13601,7 @@ add_executable(pipe_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc

3
Makefile generated

@ -925,6 +925,7 @@ LIBGPR_SRC = \
src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/global_config_env.cc \
@ -1491,7 +1492,6 @@ LIBGRPC_SRC = \
src/core/lib/matchers/matchers.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \
@ -1986,7 +1986,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/json/json_writer.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \

@ -312,6 +312,7 @@ libs:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
@ -364,6 +365,7 @@ libs:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -866,7 +868,6 @@ libs:
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/api.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
@ -1456,7 +1457,6 @@ libs:
- src/core/lib/matchers/matchers.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/api.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
@ -1971,7 +1971,6 @@ libs:
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/api.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
@ -2257,7 +2256,6 @@ libs:
- src/core/lib/json/json_writer.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/api.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
@ -4356,6 +4354,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -4424,6 +4423,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -4557,69 +4557,102 @@ targets:
build: test
language: c++
headers:
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/cpp_impl_of.h
- src/core/lib/gprpp/dual_ref_counted.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
- src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/combiner.h
- src/core/lib/iomgr/error.h
- src/core/lib/iomgr/error_internal.h
- src/core/lib/iomgr/exec_ctx.h
- src/core/lib/iomgr/executor.h
- src/core/lib/iomgr/iomgr_internal.h
- src/core/lib/promise/activity.h
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/gpr/alloc.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gpr/string.h
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
- src/core/lib/gprpp/fork.h
- src/core/lib/gprpp/global_config.h
- src/core/lib/gprpp/global_config_custom.h
- src/core/lib/gprpp/global_config_env.h
- src/core/lib/gprpp/global_config_generic.h
- src/core/lib/gprpp/host_port.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/stat.h
- src/core/lib/gprpp/status_helper.h
- src/core/lib/gprpp/sync.h
- src/core/lib/gprpp/thd.h
- src/core/lib/gprpp/time_util.h
- src/core/lib/profiling/timers.h
- src/core/lib/promise/arena_promise.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/promise_factory.h
- src/core/lib/promise/detail/promise_like.h
- src/core/lib/promise/detail/status.h
- src/core/lib/promise/detail/switch.h
- src/core/lib/promise/exec_ctx_wakeup_scheduler.h
- src/core/lib/promise/loop.h
- src/core/lib/promise/map.h
- src/core/lib/promise/poll.h
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
- src/core/lib/resource_quota/trace.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/slice/slice_utils.h
- src/core/lib/slice/static_slice.h
src:
- src/core/lib/debug/trace.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/iomgr/combiner.cc
- src/core/lib/iomgr/error.cc
- src/core/lib/iomgr/exec_ctx.cc
- src/core/lib/iomgr/executor.cc
- src/core/lib/iomgr/iomgr_internal.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/slice/static_slice.cc
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/cpu_iphone.cc
- src/core/lib/gpr/cpu_linux.cc
- src/core/lib/gpr/cpu_posix.cc
- src/core/lib/gpr/cpu_windows.cc
- src/core/lib/gpr/env_linux.cc
- src/core/lib/gpr/env_posix.cc
- src/core/lib/gpr/env_windows.cc
- src/core/lib/gpr/log.cc
- src/core/lib/gpr/log_android.cc
- src/core/lib/gpr/log_linux.cc
- src/core/lib/gpr/log_posix.cc
- src/core/lib/gpr/log_windows.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gpr/string.cc
- src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
- src/core/lib/gpr/time.cc
- src/core/lib/gpr/time_posix.cc
- src/core/lib/gpr/time_precise.cc
- src/core/lib/gpr/time_windows.cc
- src/core/lib/gpr/tmpfile_msys.cc
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
- src/core/lib/gprpp/host_port.cc
- src/core/lib/gprpp/mpscq.cc
- src/core/lib/gprpp/stat_posix.cc
- src/core/lib/gprpp/stat_windows.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/thd_posix.cc
- src/core/lib/gprpp/thd_windows.cc
- src/core/lib/gprpp/time_util.cc
- src/core/lib/profiling/basic_timers.cc
- src/core/lib/profiling/stap_timers.cc
- test/core/promise/arena_promise_test.cc
deps:
- absl/status:statusor
- absl/base:base
- absl/base:core_headers
- absl/memory:memory
- absl/random:random
- absl/status:status
- absl/strings:cord
- absl/strings:str_format
- absl/strings:strings
- absl/synchronization:synchronization
- absl/time:time
- absl/types:optional
- absl/types:variant
- gpr
- upb
uses_polling: false
- name: async_end2end_test
gtest: true
@ -5070,70 +5103,101 @@ targets:
build: test
language: c++
headers:
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/gpr/alloc.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gpr/string.h
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/chunked_vector.h
- src/core/lib/gprpp/cpp_impl_of.h
- src/core/lib/gprpp/dual_ref_counted.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
- src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/combiner.h
- src/core/lib/iomgr/error.h
- src/core/lib/iomgr/error_internal.h
- src/core/lib/iomgr/exec_ctx.h
- src/core/lib/iomgr/executor.h
- src/core/lib/iomgr/iomgr_internal.h
- src/core/lib/promise/activity.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/promise_factory.h
- src/core/lib/promise/detail/promise_like.h
- src/core/lib/promise/detail/status.h
- src/core/lib/promise/detail/switch.h
- src/core/lib/promise/exec_ctx_wakeup_scheduler.h
- src/core/lib/promise/loop.h
- src/core/lib/promise/map.h
- src/core/lib/promise/poll.h
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
- src/core/lib/resource_quota/trace.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/slice/slice_utils.h
- src/core/lib/slice/static_slice.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
- src/core/lib/gprpp/fork.h
- src/core/lib/gprpp/global_config.h
- src/core/lib/gprpp/global_config_custom.h
- src/core/lib/gprpp/global_config_env.h
- src/core/lib/gprpp/global_config_generic.h
- src/core/lib/gprpp/host_port.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/stat.h
- src/core/lib/gprpp/status_helper.h
- src/core/lib/gprpp/sync.h
- src/core/lib/gprpp/thd.h
- src/core/lib/gprpp/time_util.h
- src/core/lib/profiling/timers.h
src:
- src/core/lib/debug/trace.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/iomgr/combiner.cc
- src/core/lib/iomgr/error.cc
- src/core/lib/iomgr/exec_ctx.cc
- src/core/lib/iomgr/executor.cc
- src/core/lib/iomgr/iomgr_internal.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/slice/static_slice.cc
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/cpu_iphone.cc
- src/core/lib/gpr/cpu_linux.cc
- src/core/lib/gpr/cpu_posix.cc
- src/core/lib/gpr/cpu_windows.cc
- src/core/lib/gpr/env_linux.cc
- src/core/lib/gpr/env_posix.cc
- src/core/lib/gpr/env_windows.cc
- src/core/lib/gpr/log.cc
- src/core/lib/gpr/log_android.cc
- src/core/lib/gpr/log_linux.cc
- src/core/lib/gpr/log_posix.cc
- src/core/lib/gpr/log_windows.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gpr/string.cc
- src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
- src/core/lib/gpr/time.cc
- src/core/lib/gpr/time_posix.cc
- src/core/lib/gpr/time_precise.cc
- src/core/lib/gpr/time_windows.cc
- src/core/lib/gpr/tmpfile_msys.cc
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
- src/core/lib/gprpp/host_port.cc
- src/core/lib/gprpp/mpscq.cc
- src/core/lib/gprpp/stat_posix.cc
- src/core/lib/gprpp/stat_windows.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/thd_posix.cc
- src/core/lib/gprpp/thd_windows.cc
- src/core/lib/gprpp/time_util.cc
- src/core/lib/profiling/basic_timers.cc
- src/core/lib/profiling/stap_timers.cc
- test/core/gprpp/chunked_vector_test.cc
deps:
- absl/status:statusor
- absl/types:variant
- absl/base:base
- absl/base:core_headers
- absl/memory:memory
- absl/random:random
- absl/status:status
- absl/strings:cord
- absl/strings:str_format
- absl/strings:strings
- absl/synchronization:synchronization
- absl/time:time
- absl/types:optional
- absl/utility:utility
- gpr
- upb
uses_polling: false
- name: cli_call_test
gtest: true
@ -5348,6 +5412,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
@ -5406,6 +5471,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -5907,6 +5973,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -5979,6 +6046,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -6549,6 +6617,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -6617,6 +6686,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -6884,6 +6954,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
@ -6950,6 +7021,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -7049,6 +7121,7 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -7118,6 +7191,7 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc

2
config.m4 generated

@ -436,6 +436,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/global_config_env.cc \
@ -553,7 +554,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/profiling/stap_timers.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \

2
config.w32 generated

@ -402,6 +402,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\tmpfile_posix.cc " +
"src\\core\\lib\\gpr\\tmpfile_windows.cc " +
"src\\core\\lib\\gpr\\wrap_memcpy.cc " +
"src\\core\\lib\\gprpp\\arena.cc " +
"src\\core\\lib\\gprpp\\examine_stack.cc " +
"src\\core\\lib\\gprpp\\fork.cc " +
"src\\core\\lib\\gprpp\\global_config_env.cc " +
@ -519,7 +520,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\profiling\\stap_timers.cc " +
"src\\core\\lib\\promise\\activity.cc " +
"src\\core\\lib\\resource_quota\\api.cc " +
"src\\core\\lib\\resource_quota\\arena.cc " +
"src\\core\\lib\\resource_quota\\memory_quota.cc " +
"src\\core\\lib\\resource_quota\\resource_quota.cc " +
"src\\core\\lib\\resource_quota\\thread_quota.cc " +

4
gRPC-C++.podspec generated

@ -609,6 +609,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -731,7 +732,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',
@ -1332,6 +1332,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1454,7 +1455,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',

6
gRPC-Core.podspec generated

@ -944,6 +944,8 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/useful.h',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1183,8 +1185,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.cc',
@ -1869,6 +1869,7 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1991,7 +1992,6 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',

4
grpc.gemspec generated

@ -863,6 +863,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/tmpfile_windows.cc )
s.files += %w( src/core/lib/gpr/useful.h )
s.files += %w( src/core/lib/gpr/wrap_memcpy.cc )
s.files += %w( src/core/lib/gprpp/arena.cc )
s.files += %w( src/core/lib/gprpp/arena.h )
s.files += %w( src/core/lib/gprpp/atomic_utils.h )
s.files += %w( src/core/lib/gprpp/bitset.h )
s.files += %w( src/core/lib/gprpp/chunked_vector.h )
@ -1102,8 +1104,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/promise/seq.h )
s.files += %w( src/core/lib/resource_quota/api.cc )
s.files += %w( src/core/lib/resource_quota/api.h )
s.files += %w( src/core/lib/resource_quota/arena.cc )
s.files += %w( src/core/lib/resource_quota/arena.h )
s.files += %w( src/core/lib/resource_quota/memory_quota.cc )
s.files += %w( src/core/lib/resource_quota/memory_quota.h )
s.files += %w( src/core/lib/resource_quota/resource_quota.cc )

3
grpc.gyp generated

@ -447,6 +447,7 @@
'src/core/lib/gpr/tmpfile_posix.cc',
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/examine_stack.cc',
'src/core/lib/gprpp/fork.cc',
'src/core/lib/gprpp/global_config_env.cc',
@ -946,7 +947,6 @@
'src/core/lib/matchers/matchers.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',
@ -1413,7 +1413,6 @@
'src/core/lib/json/json_writer.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',

4
package.xml generated

@ -843,6 +843,8 @@
<file baseinstalldir="/" name="src/core/lib/gpr/tmpfile_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/wrap_memcpy.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/arena.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/bitset.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/chunked_vector.h" role="src" />
@ -1082,8 +1084,6 @@
<file baseinstalldir="/" name="src/core/lib/promise/seq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/api.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/api.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/arena.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/memory_quota.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/memory_quota.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/resource_quota.cc" role="src" />

@ -22,7 +22,7 @@
#include <grpc/slice.h>
#include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/slice/slice.h"
namespace grpc_core {

@ -31,9 +31,9 @@
#include "src/core/ext/service_config/service_config_call_data.h"
#include "src/core/ext/service_config/service_config_parser.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/metadata_batch.h"
// Channel arg key for ConfigSelector.

@ -23,10 +23,10 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -29,7 +29,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/proto/grpc/health/v1/health.upb.h"
@ -61,10 +60,6 @@ HealthCheckClient::HealthCheckClient(
connected_subchannel_(std::move(connected_subchannel)),
interested_parties_(interested_parties),
channelz_node_(std::move(channelz_node)),
call_allocator_(
ResourceQuotaFromChannelArgs(connected_subchannel_->args())
->memory_quota()
->CreateMemoryAllocator(service_name_)),
watcher_(std::move(watcher)),
retry_backoff_(
BackOff::Options()
@ -259,8 +254,7 @@ HealthCheckClient::CallState::CallState(
: health_check_client_(std::move(health_check_client)),
pollent_(grpc_polling_entity_create_from_pollset_set(interested_parties)),
arena_(Arena::Create(health_check_client_->connected_subchannel_
->GetInitialCallSizeEstimate(),
&health_check_client_->call_allocator_)),
->GetInitialCallSizeEstimate())),
payload_(context_),
send_initial_metadata_(arena_),
send_trailing_metadata_(arena_),

@ -29,6 +29,7 @@
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -36,7 +37,6 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
@ -60,7 +60,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
class CallState : public Orphanable {
public:
CallState(RefCountedPtr<HealthCheckClient> health_check_client,
grpc_pollset_set* interested_parties);
grpc_pollset_set* interested_parties_);
~CallState() override;
void Orphan() override;
@ -155,7 +155,6 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
grpc_pollset_set* interested_parties_; // Do not own.
RefCountedPtr<channelz::SubchannelNode> channelz_node_;
MemoryAllocator call_allocator_;
Mutex mu_;
RefCountedPtr<ConnectivityStateWatcherInterface> watcher_

@ -27,13 +27,13 @@
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/metadata.h"

@ -25,7 +25,6 @@
#include "src/core/ext/transport/binder/transport/binder_transport.h"
#include "src/core/ext/transport/binder/wire_format/binder.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
@ -54,9 +53,6 @@ grpc_channel* CreateDirectBinderChannelImplForTesting(
grpc_arg default_authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("binder.authority"));
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args* final_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
grpc_error_handle error = GRPC_ERROR_NONE;
@ -65,7 +61,6 @@ grpc_channel* CreateDirectBinderChannelImplForTesting(
GRPC_CLIENT_DIRECT_CHANNEL, transport, &error);
// TODO(mingcl): Handle error properly
GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(final_args);
return channel;
}

@ -650,6 +650,10 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
: t(t),
refcount(refcount),
reffer(this),
stream_reservation(t->memory_owner.MakeReservation(
grpc_core::kResourceQuotaCallSize)), // TODO(ctiller): sizeof(*this),
// or better, move allocation to
// memory quota.
initial_metadata_buffer(arena),
trailing_metadata_buffer(arena) {
if (server_data) {

@ -523,6 +523,8 @@ struct grpc_chttp2_stream {
explicit Reffer(grpc_chttp2_stream* s);
} reffer;
grpc_core::MemoryAllocator::Reservation stream_reservation;
grpc_closure destroy_stream;
grpc_closure* destroy_stream_arg;

@ -54,9 +54,9 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/transport.h"
typedef struct grpc_channel_element grpc_channel_element;

@ -69,9 +69,9 @@ void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder* b,
b->target = gpr_strdup(target);
}
std::string grpc_channel_stack_builder_get_target(
const char* grpc_channel_stack_builder_get_target(
grpc_channel_stack_builder* b) {
return b->target == nullptr ? std::string() : std::string(b->target);
return b->target;
}
static grpc_channel_stack_builder_iterator* create_iterator_at_filter_node(

@ -43,7 +43,7 @@ void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder* builder,
void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder* b,
const char* target);
std::string grpc_channel_stack_builder_get_target(
const char* grpc_channel_stack_builder_get_target(
grpc_channel_stack_builder* b);
/// Attach \a transport to the builder (does not take ownership)

@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/gprpp/arena.h"
#include <string.h>
@ -61,24 +61,22 @@ Arena::~Arena() {
}
}
Arena* Arena::Create(size_t initial_size, MemoryAllocator* memory_allocator) {
return new (ArenaStorage(initial_size))
Arena(initial_size, 0, memory_allocator);
Arena* Arena::Create(size_t initial_size) {
return new (ArenaStorage(initial_size)) Arena(initial_size);
}
std::pair<Arena*, void*> Arena::CreateWithAlloc(
size_t initial_size, size_t alloc_size, MemoryAllocator* memory_allocator) {
std::pair<Arena*, void*> Arena::CreateWithAlloc(size_t initial_size,
size_t alloc_size) {
static constexpr size_t base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Arena));
auto* new_arena = new (ArenaStorage(initial_size))
Arena(initial_size, alloc_size, memory_allocator);
auto* new_arena =
new (ArenaStorage(initial_size)) Arena(initial_size, alloc_size);
void* first_alloc = reinterpret_cast<char*>(new_arena) + base_size;
return std::make_pair(new_arena, first_alloc);
}
size_t Arena::Destroy() {
size_t size = total_used_.load(std::memory_order_relaxed);
memory_allocator_->Release(total_allocated_.load(std::memory_order_relaxed));
this->~Arena();
gpr_free_aligned(this);
return size;
@ -93,14 +91,13 @@ void* Arena::AllocZone(size_t size) {
static constexpr size_t zone_base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Zone));
size_t alloc_size = zone_base_size + size;
memory_allocator_->Reserve(alloc_size);
total_allocated_.fetch_add(alloc_size, std::memory_order_relaxed);
Zone* z = new (gpr_malloc_aligned(alloc_size, GPR_MAX_ALIGNMENT)) Zone();
auto* prev = last_zone_.load(std::memory_order_relaxed);
do {
z->prev = prev;
} while (!last_zone_.compare_exchange_weak(prev, z, std::memory_order_relaxed,
std::memory_order_relaxed));
{
gpr_spinlock_lock(&arena_growth_spinlock_);
z->prev = last_zone_;
last_zone_ = z;
gpr_spinlock_unlock(&arena_growth_spinlock_);
}
return reinterpret_cast<char*>(z) + zone_base_size;
}

@ -22,8 +22,8 @@
// Tracks the total memory allocated against it, so that future arenas can
// pre-allocate the right amount of memory
#ifndef GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H
#define GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H
#ifndef GRPC_CORE_LIB_GPRPP_ARENA_H
#define GRPC_CORE_LIB_GPRPP_ARENA_H
#include <grpc/support/port_platform.h>
@ -38,21 +38,20 @@
#include <grpc/support/sync.h>
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/gpr/spinlock.h"
namespace grpc_core {
class Arena {
public:
// Create an arena, with \a initial_size bytes in the first allocated buffer.
static Arena* Create(size_t initial_size, MemoryAllocator* memory_allocator);
static Arena* Create(size_t initial_size);
// Create an arena, with \a initial_size bytes in the first allocated buffer,
// and return both a void pointer to the returned arena and a void* with the
// first allocation.
static std::pair<Arena*, void*> CreateWithAlloc(
size_t initial_size, size_t alloc_size,
MemoryAllocator* memory_allocator);
static std::pair<Arena*, void*> CreateWithAlloc(size_t initial_size,
size_t alloc_size);
// Destroy an arena, returning the total number of bytes allocated.
size_t Destroy();
@ -97,11 +96,9 @@ class Arena {
// quick optimization (avoiding an atomic fetch-add) for the common case
// where we wish to create an arena and then perform an immediate
// allocation.
explicit Arena(size_t initial_size, size_t initial_alloc,
MemoryAllocator* memory_allocator)
explicit Arena(size_t initial_size, size_t initial_alloc = 0)
: total_used_(GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_alloc)),
initial_zone_size_(initial_size),
memory_allocator_(memory_allocator) {}
initial_zone_size_(initial_size) {}
~Arena();
@ -110,16 +107,14 @@ class Arena {
// Keep track of the total used size. We use this in our call sizing
// hysteresis.
std::atomic<size_t> total_used_{0};
std::atomic<size_t> total_allocated_{0};
const size_t initial_zone_size_;
gpr_spinlock arena_growth_spinlock_ = GPR_SPINLOCK_STATIC_INITIALIZER;
// If the initial arena allocation wasn't enough, we allocate additional zones
// in a reverse linked list. Each additional zone consists of (1) a pointer to
// the zone added before this zone (null if this is the first additional zone)
// and (2) the allocated memory. The arena itself maintains a pointer to the
// last zone; the zone list is reverse-walked during arena destruction only.
std::atomic<Zone*> last_zone_{nullptr};
// The backing memory quota
MemoryAllocator* const memory_allocator_;
Zone* last_zone_ = nullptr;
};
// Smart pointer for arenas when the final size is not required.
@ -127,11 +122,10 @@ struct ScopedArenaDeleter {
void operator()(Arena* arena) { arena->Destroy(); }
};
using ScopedArenaPtr = std::unique_ptr<Arena, ScopedArenaDeleter>;
inline ScopedArenaPtr MakeScopedArena(size_t initial_size,
MemoryAllocator* memory_allocator) {
return ScopedArenaPtr(Arena::Create(initial_size, memory_allocator));
inline ScopedArenaPtr MakeScopedArena(size_t initial_size) {
return ScopedArenaPtr(Arena::Create(initial_size));
}
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H */
#endif /* GRPC_CORE_LIB_GPRPP_ARENA_H */

@ -17,8 +17,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -19,8 +19,8 @@
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/promise/poll.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -27,6 +27,7 @@ namespace grpc_core {
// TODO(ctiller): This is a hack. We need to do real accounting instead of
// hard coding.
constexpr size_t kResourceQuotaCallSize = 15 * 1024;
constexpr size_t kResourceQuotaChannelSize = 50 * 1024;
// Retrieve the resource quota from the channel args.

@ -29,9 +29,9 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"

@ -21,10 +21,10 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/security/credentials/credentials.h"
extern grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount;

@ -45,11 +45,11 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_split.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/slice/slice_utils.h"
@ -362,8 +362,7 @@ grpc_error_handle grpc_call_create(const grpc_call_create_args* args,
call_and_stack_size + (args->parent ? sizeof(child_call) : 0);
std::pair<grpc_core::Arena*, void*> arena_with_call =
grpc_core::Arena::CreateWithAlloc(initial_size, call_alloc_size,
&*args->channel->allocator);
grpc_core::Arena::CreateWithAlloc(initial_size, call_alloc_size);
arena = arena_with_call.first;
call = new (arena_with_call.second) grpc_call(arena, *args);
*out_call = call;

@ -26,7 +26,7 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h"

@ -41,7 +41,6 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
@ -60,7 +59,7 @@ static void destroy_channel(void* arg, grpc_error_handle error);
grpc_channel* grpc_channel_create_with_builder(
grpc_channel_stack_builder* builder,
grpc_channel_stack_type channel_stack_type, grpc_error_handle* error) {
std::string target = grpc_channel_stack_builder_get_target(builder);
char* target = gpr_strdup(grpc_channel_stack_builder_get_target(builder));
grpc_channel_args* args = grpc_channel_args_copy(
grpc_channel_stack_builder_get_channel_arguments(builder));
grpc_channel* channel;
@ -69,7 +68,6 @@ grpc_channel* grpc_channel_create_with_builder(
} else {
GRPC_STATS_INC_CLIENT_CHANNELS_CREATED();
}
std::string name = grpc_channel_stack_builder_get_target(builder);
grpc_error_handle builder_error = grpc_channel_stack_builder_finish(
builder, sizeof(grpc_channel), 1, destroy_channel, nullptr,
reinterpret_cast<void**>(&channel));
@ -82,15 +80,13 @@ grpc_channel* grpc_channel_create_with_builder(
} else {
GRPC_ERROR_UNREF(builder_error);
}
gpr_free(target);
grpc_channel_args_destroy(args);
return nullptr;
}
channel->target.Init(std::move(target));
channel->target = target;
channel->is_client = grpc_channel_stack_type_is_client(channel_stack_type);
channel->registration_table.Init();
channel->allocator.Init(grpc_core::ResourceQuotaFromChannelArgs(args)
->memory_quota()
->CreateMemoryOwner(name));
gpr_atm_no_barrier_store(
&channel->call_size_estimate,
@ -201,10 +197,11 @@ void CreateChannelzNode(grpc_channel_stack_builder* builder) {
const bool is_internal_channel = grpc_channel_args_find_bool(
args, GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL, false);
// Create the channelz node.
std::string target = grpc_channel_stack_builder_get_target(builder);
const char* target = grpc_channel_stack_builder_get_target(builder);
grpc_core::RefCountedPtr<grpc_core::channelz::ChannelNode> channelz_node =
grpc_core::MakeRefCounted<grpc_core::channelz::ChannelNode>(
target.c_str(), channel_tracer_max_memory, is_internal_channel);
target != nullptr ? target : "", channel_tracer_max_memory,
is_internal_channel);
channelz_node->AddTraceEvent(
grpc_core::channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string("Channel created"));
@ -316,7 +313,7 @@ void grpc_channel_update_call_size_estimate(grpc_channel* channel,
char* grpc_channel_get_target(grpc_channel* channel) {
GRPC_API_TRACE("grpc_channel_get_target(channel=%p)", 1, (channel));
return gpr_strdup(channel->target->c_str());
return gpr_strdup(channel->target);
}
void grpc_channel_get_info(grpc_channel* channel,
@ -489,8 +486,7 @@ static void destroy_channel(void* arg, grpc_error_handle /*error*/) {
}
grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CHANNEL(channel));
channel->registration_table.Destroy();
channel->allocator.Destroy();
channel->target.Destroy();
gpr_free(channel->target);
gpr_free(channel);
// See comment in grpc_channel_create() for why we do this.
grpc_shutdown();

@ -110,9 +110,8 @@ struct grpc_channel {
grpc_core::ManualConstructor<grpc_core::CallRegistrationTable>
registration_table;
grpc_core::RefCountedPtr<grpc_core::channelz::ChannelNode> channelz_node;
grpc_core::ManualConstructor<grpc_core::MemoryAllocator> allocator;
grpc_core::ManualConstructor<std::string> target;
char* target;
};
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack*)((c) + 1))

@ -24,13 +24,13 @@
#include <stddef.h>
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/connectivity_state.h"

@ -411,6 +411,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/gpr/tmpfile_posix.cc',
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/examine_stack.cc',
'src/core/lib/gprpp/fork.cc',
'src/core/lib/gprpp/global_config_env.cc',
@ -528,7 +529,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/profiling/stap_timers.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',

@ -114,15 +114,15 @@ static void chttp2_init_client_socketpair(
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
cs.client_args = client_args;
cs.f = f;
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
client_setup_transport(&cs, transport);
grpc_channel_args_destroy(client_args);
client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
}

@ -125,15 +125,15 @@ static void chttp2_init_client_socketpair(
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
cs.client_args = client_args;
cs.f = f;
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
client_setup_transport(&cs, transport);
grpc_channel_args_destroy(client_args);
client_setup_transport(&cs, transport);
GPR_ASSERT(f->client);
}

@ -189,8 +189,7 @@ static void do_connect(void* arg, grpc_error_handle error) {
core_server->channel_args(), server, false);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"SetupTransport",
core_server->SetupTransport(transport, nullptr,
core_server->channel_args(), nullptr)));
core_server->SetupTransport(transport, nullptr, nullptr, nullptr)));
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, fc->closure, GRPC_ERROR_NONE);

@ -62,14 +62,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
args = grpc_channel_args_copy_and_add(nullptr, &authority_arg, 1);
const grpc_channel_args* channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel* channel =
grpc_channel_create("test-target", channel_args,
GRPC_CLIENT_DIRECT_CHANNEL, transport, nullptr);
grpc_channel* channel = grpc_channel_create(
"test-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport, nullptr);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(channel_args);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call* call = grpc_channel_create_call(
channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host,

@ -58,11 +58,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
.PreconditionChannelArgs(nullptr);
grpc_transport* transport =
grpc_create_chttp2_transport(channel_args, mock_endpoint, false);
grpc_channel_args_destroy(channel_args);
grpc_resource_quota_unref(resource_quota);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"SetupTransport", grpc_core::Server::FromC(server)->SetupTransport(
transport, nullptr, channel_args, nullptr)));
grpc_channel_args_destroy(channel_args);
transport, nullptr, nullptr, nullptr)));
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
grpc_call* call1 = nullptr;

@ -16,7 +16,7 @@
*
*/
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/gprpp/arena.h"
#include <inttypes.h>
#include <string.h>
@ -32,16 +32,11 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/test_config.h"
using grpc_core::Arena;
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static void test_noop(void) { Arena::Create(1, g_memory_allocator)->Destroy(); }
static void test_noop(void) { Arena::Create(1)->Destroy(); }
static void test(const char* name, size_t init_size, const size_t* allocs,
size_t nallocs) {
@ -55,7 +50,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs,
std::string s = absl::StrJoin(parts, "");
gpr_log(GPR_INFO, "%s", s.c_str());
Arena* a = Arena::Create(init_size, g_memory_allocator);
Arena* a = Arena::Create(init_size);
void** ps = static_cast<void**>(gpr_zalloc(sizeof(*ps) * nallocs));
for (size_t i = 0; i < nallocs; i++) {
ps[i] = a->Alloc(allocs[i]);
@ -101,7 +96,7 @@ static void concurrent_test(void) {
concurrent_test_args args;
gpr_event_init(&args.ev_start);
args.arena = Arena::Create(1024, g_memory_allocator);
args.arena = Arena::Create(1024);
grpc_core::Thread thds[CONCURRENT_TEST_THREADS];

@ -306,7 +306,6 @@ grpc_cc_test(
deps = [
"//:chunked_vector",
"//:gpr_base",
"//:resource_quota",
"//test/core/util:grpc_suppressions",
],
)
@ -321,7 +320,6 @@ grpc_proto_fuzzer(
uses_polling = False,
deps = [
"//:chunked_vector",
"//:resource_quota",
"//test/core/util:grpc_test_util",
],
)

@ -15,17 +15,12 @@
#include <vector>
#include "src/core/lib/gprpp/chunked_vector.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/gprpp/chunked_vector_fuzzer.pb.h"
bool squelch = true;
bool leak_check = true;
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static constexpr size_t kChunkSize = 17;
using IntHdl = std::shared_ptr<int>;
@ -144,7 +139,7 @@ class Fuzzer {
return &vectors_.emplace(index, Comparison(arena_.get())).first->second;
}
ScopedArenaPtr arena_ = MakeScopedArena(128, g_memory_allocator);
ScopedArenaPtr arena_ = MakeScopedArena(128);
std::map<int, Comparison> vectors_;
};
} // namespace grpc_core

@ -16,25 +16,20 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
namespace grpc_core {
namespace testing {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
static constexpr size_t kInitialArenaSize = 1024;
static constexpr size_t kChunkSize = 3;
TEST(ChunkedVector, Noop) {
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
auto arena = MakeScopedArena(kInitialArenaSize);
ChunkedVector<int, kChunkSize> v(arena.get());
EXPECT_EQ(0, v.size());
}
TEST(ChunkedVector, Stack) {
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
auto arena = MakeScopedArena(kInitialArenaSize);
ChunkedVector<int, kChunkSize> v(arena.get());
// Populate 2 chunks of memory, and 2/3 of a final chunk.
@ -76,7 +71,7 @@ TEST(ChunkedVector, Stack) {
}
TEST(ChunkedVector, Iterate) {
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
auto arena = MakeScopedArena(kInitialArenaSize);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
v.EmplaceBack(2);
@ -108,7 +103,7 @@ TEST(ChunkedVector, Iterate) {
}
TEST(ChunkedVector, ConstIterate) {
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
auto arena = MakeScopedArena(kInitialArenaSize);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
v.EmplaceBack(2);
@ -140,7 +135,7 @@ TEST(ChunkedVector, ConstIterate) {
}
TEST(ChunkedVector, Clear) {
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
auto arena = MakeScopedArena(kInitialArenaSize);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
EXPECT_EQ(v.size(), 1);

@ -75,7 +75,6 @@ grpc_cc_test(
uses_polling = False,
deps = [
"//:arena_promise",
"//:resource_quota",
"//test/core/util:grpc_suppressions",
],
)

@ -18,15 +18,10 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
namespace grpc_core {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
TEST(ArenaPromiseTest, AllocatedWorks) {
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
int x = 42;
ArenaPromise<int> p(arena.get(), [x] { return Poll<int>(x); });
EXPECT_EQ(p(), Poll<int>(42));
@ -35,7 +30,7 @@ TEST(ArenaPromiseTest, AllocatedWorks) {
}
TEST(ArenaPromiseTest, DestructionWorks) {
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
auto x = std::make_shared<int>(42);
auto p = ArenaPromise<int>(arena.get(), [x] { return Poll<int>(*x); });
ArenaPromise<int> q(std::move(p));

@ -32,14 +32,9 @@
#include <grpcpp/security/binder_security_policy.h>
#include "src/core/ext/transport/binder/transport/binder_stream.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/transport/binder/mock_objects.h"
#include "test/core/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
namespace grpc_binder {
namespace {
@ -50,8 +45,7 @@ using ::testing::Return;
class BinderTransportTest : public ::testing::Test {
public:
BinderTransportTest()
: arena_(grpc_core::Arena::Create(/* initial_size = */ 1,
g_memory_allocator)),
: arena_(grpc_core::Arena::Create(/* initial_size = */ 1)),
transport_(grpc_create_binder_transport_client(
absl::make_unique<NiceMock<MockBinder>>(),
std::make_shared<
@ -217,8 +211,7 @@ struct MakeSendInitialMetadata {
std::vector<grpc_linked_mdelem> storage;
grpc_linked_mdelem method_ref_storage;
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
};
@ -250,8 +243,7 @@ struct MakeSendTrailingMetadata {
&grpc_trailing_metadata;
}
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
};
@ -274,8 +266,7 @@ struct MakeRecvInitialMetadata {
~MakeRecvInitialMetadata() {}
MockGrpcClosure ready;
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
absl::Notification notification;
};
@ -318,8 +309,7 @@ struct MakeRecvTrailingMetadata {
~MakeRecvTrailingMetadata() {}
MockGrpcClosure ready;
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
absl::Notification notification;
};

@ -21,7 +21,6 @@
#include "src/core/ext/transport/binder/transport/binder_transport.h"
#include "src/core/ext/transport/binder/wire_format/wire_reader_impl.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/error_utils.h"
@ -108,16 +107,14 @@ std::shared_ptr<grpc::Channel> BinderChannelForTesting(
} // namespace end2end_testing
} // namespace grpc_binder
grpc_channel* grpc_binder_channel_create_for_testing(
grpc_server* server, const grpc_channel_args* args, void* /*reserved*/) {
grpc_channel* grpc_binder_channel_create_for_testing(grpc_server* server,
grpc_channel_args* args,
void* /*reserved*/) {
grpc_core::ExecCtx exec_ctx;
grpc_arg default_authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test.authority"));
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args* client_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
@ -131,7 +128,6 @@ grpc_channel* grpc_binder_channel_create_for_testing(
grpc_channel_create("binder", client_args, GRPC_CLIENT_DIRECT_CHANNEL,
client_transport, &error);
GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(client_args);
return channel;
}

@ -35,7 +35,8 @@ std::shared_ptr<grpc::Channel> BinderChannelForTesting(
} // namespace end2end_testing
} // namespace grpc_binder
grpc_channel* grpc_binder_channel_create_for_testing(
grpc_server* server, const grpc_channel_args* args, void* /*reserved*/);
grpc_channel* grpc_binder_channel_create_for_testing(grpc_server* server,
grpc_channel_args* args,
void* /*reserved*/);
#endif // GRPC_TEST_CORE_TRANSPORT_BINDER_END2END_TESTING_CHANNEL_CREATE_H

@ -32,7 +32,6 @@
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/ext/transport/chttp2/transport/hpack_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/transport/metadata.h"
@ -42,10 +41,6 @@
#define TEST(x) run_test(x, #x)
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
grpc_core::HPackCompressor* g_compressor;
int g_failure = 0;
@ -166,7 +161,7 @@ static void verify(const verify_params params, const char* expected,
va_list l;
grpc_linked_mdelem* e =
static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e) * nheaders));
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
va_start(l, nheaders);
@ -249,7 +244,7 @@ static void test_basic_headers() {
static void verify_continuation_headers(const char* key, const char* value,
bool is_eof) {
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_slice_buffer output;
grpc_mdelem elem = grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string(key)),
@ -332,7 +327,7 @@ static void test_decode_table_overflow() {
static void verify_table_size_change_match_elem_size(const char* key,
const char* value,
bool use_true_binary) {
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_slice_buffer output;
grpc_mdelem elem = grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string(key)),

@ -25,7 +25,6 @@
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/transport/chttp2/hpack_parser_fuzzer.pb.h"
@ -39,13 +38,10 @@ DEFINE_PROTO_FUZZER(const hpack_parser_fuzzer::Msg& msg) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
auto memory_allocator = grpc_core::ResourceQuota::Default()
->memory_quota()
->CreateMemoryAllocator("test-allocator");
{
std::unique_ptr<grpc_core::HPackParser> parser(new grpc_core::HPackParser);
for (int i = 0; i < msg.frames_size(); i++) {
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_core::ExecCtx exec_ctx;
grpc_metadata_batch b(arena.get());

@ -26,15 +26,10 @@
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
struct TestInput {
const char* input;
const char* expected_parse;
@ -72,7 +67,7 @@ class ParseTest : public ::testing::TestWithParam<Test> {
void TestVector(grpc_slice_split_mode mode, const char* hexstring,
std::string expect) {
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_core::ExecCtx exec_ctx;
grpc_slice input = parse_hexstring(hexstring);
grpc_slice* slices;

@ -16,7 +16,6 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "test/core/util/test_config.h"
@ -24,21 +23,18 @@
namespace grpc_core {
namespace testing {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
TEST(MetadataMapTest, Noop) {
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
MetadataMap<>(arena.get());
}
TEST(MetadataMapTest, NoopWithDeadline) {
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
MetadataMap<GrpcTimeoutMetadata>(arena.get());
}
TEST(MetadataMapTest, SimpleOps) {
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
EXPECT_EQ(map.get_pointer(GrpcTimeoutMetadata()), nullptr);
EXPECT_EQ(map.get(GrpcTimeoutMetadata()), absl::nullopt);
@ -74,7 +70,7 @@ class FakeEncoder {
TEST(MetadataMapTest, EmptyEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
map.Encode(&encoder);
EXPECT_EQ(encoder.output(), "");
@ -82,7 +78,7 @@ TEST(MetadataMapTest, EmptyEncodeTest) {
TEST(MetadataMapTest, TimeoutEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto arena = MakeScopedArena(1024);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
map.Set(GrpcTimeoutMetadata(), 1234);
map.Encode(&encoder);

@ -35,7 +35,6 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/static_metadata.h"
@ -44,10 +43,6 @@
/* a large number */
#define MANY 10000
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static grpc_slice maybe_intern(grpc_slice in, bool intern) {
grpc_slice out = intern ? grpc_slice_intern(in) : grpc_slice_ref(in);
grpc_slice_unref(in);
@ -313,7 +308,7 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) {
}
static void test_grpc_metadata_batch_get_value_with_absent_key(void) {
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch metadata(arena.get());
std::string concatenated_value;
absl::optional<absl::string_view> value =
@ -324,7 +319,7 @@ static void test_grpc_metadata_batch_get_value_with_absent_key(void) {
static void test_grpc_metadata_batch_get_value_returns_one_value(void) {
const char* kKey = "some_key";
const char* kValue = "some_value";
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_linked_mdelem storage;
grpc_metadata_batch metadata(arena.get());
storage.md = grpc_mdelem_from_slices(
@ -342,7 +337,7 @@ static void test_grpc_metadata_batch_get_value_returns_multiple_values(void) {
const char* kKey = "some_key";
const char* kValue1 = "value1";
const char* kValue2 = "value2";
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_linked_mdelem storage1;
grpc_linked_mdelem storage2;
grpc_metadata_batch metadata(arena.get());
@ -362,7 +357,7 @@ static void test_grpc_metadata_batch_get_value_returns_multiple_values(void) {
}
static void test_grpc_chttp2_incoming_metadata_replace_or_add_works(void) {
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch buffer(arena.get());
GRPC_LOG_IF_ERROR("incoming_buffer_add",
buffer.Append(grpc_mdelem_from_slices(

@ -56,10 +56,7 @@ class EvaluateArgsTestUtil {
}
private:
MemoryAllocator allocator_ =
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"EvaluateArgsTestUtil");
ScopedArenaPtr arena_ = MakeScopedArena(1024, &allocator_);
ScopedArenaPtr arena_ = MakeScopedArena(1024);
grpc_metadata_batch metadata_{arena_.get()};
MockAuthorizationEndpoint endpoint_{/*local_uri=*/"", /*peer_uri=*/""};
grpc_auth_context auth_context_{nullptr};

@ -20,27 +20,22 @@
#include <benchmark/benchmark.h>
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/gprpp/arena.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
using grpc_core::Arena;
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static void BM_Arena_NoOp(benchmark::State& state) {
for (auto _ : state) {
Arena::Create(state.range(0), g_memory_allocator)->Destroy();
Arena::Create(state.range(0))->Destroy();
}
}
BENCHMARK(BM_Arena_NoOp)->Range(1, 1024 * 1024);
static void BM_Arena_ManyAlloc(benchmark::State& state) {
Arena* a = Arena::Create(state.range(0), g_memory_allocator);
Arena* a = Arena::Create(state.range(0));
const size_t realloc_after =
1024 * 1024 * 1024 / ((state.range(1) + 15) & 0xffffff0u);
while (state.KeepRunning()) {
@ -48,7 +43,7 @@ static void BM_Arena_ManyAlloc(benchmark::State& state) {
// periodically recreate arena to avoid OOM
if (state.iterations() % realloc_after == 0) {
a->Destroy();
a = Arena::Create(state.range(0), g_memory_allocator);
a = Arena::Create(state.range(0));
}
}
a->Destroy();
@ -57,7 +52,7 @@ BENCHMARK(BM_Arena_ManyAlloc)->Ranges({{1, 1024 * 1024}, {1, 32 * 1024}});
static void BM_Arena_Batch(benchmark::State& state) {
for (auto _ : state) {
Arena* a = Arena::Create(state.range(0), g_memory_allocator);
Arena* a = Arena::Create(state.range(0));
for (int i = 0; i < state.range(1); i++) {
a->Alloc(state.range(2));
}

@ -39,10 +39,8 @@
#include "src/core/ext/filters/message_size/message_size_filter.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/transport_impl.h"
#include "src/cpp/client/create_channel_internal.h"
@ -51,10 +49,6 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
void BM_Zalloc(benchmark::State& state) {
// speed of light for call creation is zalloc, so benchmark a few interesting
// sizes
@ -541,15 +535,14 @@ static void BM_IsolatedFilter(benchmark::State& state) {
TestOp test_op_data;
const int kArenaSize = 4096;
grpc_call_context_element context[GRPC_CONTEXT_COUNT] = {};
grpc_call_element_args call_args{
call_stack,
nullptr,
context,
method,
start_time,
deadline,
grpc_core::Arena::Create(kArenaSize, g_memory_allocator),
nullptr};
grpc_call_element_args call_args{call_stack,
nullptr,
context,
method,
start_time,
deadline,
grpc_core::Arena::Create(kArenaSize),
nullptr};
while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
GRPC_ERROR_UNREF(
@ -561,8 +554,7 @@ static void BM_IsolatedFilter(benchmark::State& state) {
// recreate arena every 64k iterations to avoid oom
if (0 == (state.iterations() & 0xffff)) {
call_args.arena->Destroy();
call_args.arena =
grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
call_args.arena = grpc_core::Arena::Create(kArenaSize);
}
}
call_args.arena->Destroy();
@ -704,13 +696,9 @@ class IsolatedCallFixture : public TrackCounters {
// the grpc_shutdown() run by grpc_channel_destroy(). So we need to
// call grpc_init() manually here to balance things out.
grpc_init();
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
grpc_channel_stack_builder_set_name(builder, "phony");
grpc_channel_stack_builder_set_target(builder, "phony_target");
grpc_channel_stack_builder_set_channel_arguments(builder, args);
GPR_ASSERT(grpc_channel_stack_builder_append_filter(
builder, &isolated_call_filter::isolated_call_filter, nullptr,
nullptr));
@ -720,7 +708,6 @@ class IsolatedCallFixture : public TrackCounters {
nullptr);
}
cq_ = grpc_completion_queue_create_for_next(nullptr);
grpc_channel_args_destroy(args);
}
void Finish(benchmark::State& state) override {

@ -30,7 +30,6 @@
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/transport/metadata_batch.h"
@ -40,10 +39,6 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static grpc_slice MakeSlice(std::vector<uint8_t> bytes) {
grpc_slice s = grpc_slice_malloc(bytes.size());
uint8_t* p = GRPC_SLICE_START_PTR(s);
@ -74,7 +69,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
grpc_millis saved_now = grpc_core::ExecCtx::Get()->Now();
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
b.Set(grpc_core::GrpcTimeoutMetadata(), saved_now + 30 * 1000);
@ -116,7 +111,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
static bool logged_representative_output = false;
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
Fixture::Prepare(&b);
@ -473,7 +468,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
std::vector<grpc_slice> benchmark_slices = Fixture::GetBenchmarkSlices();
grpc_core::HPackParser p;
const int kArenaSize = 4096 * 4096;
auto* arena = grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
auto* arena = grpc_core::Arena::Create(kArenaSize);
grpc_core::ManualConstructor<grpc_metadata_batch> b;
b.Init(arena);
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
@ -494,7 +489,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
if (0 == (state.iterations() & 0xfff)) {
b.Destroy();
arena->Destroy();
arena = grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
arena = grpc_core::Arena::Create(kArenaSize);
b.Init(arena);
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
grpc_core::HPackParser::Boundary::None,

@ -41,10 +41,6 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
////////////////////////////////////////////////////////////////////////////////
// Helper classes
//
@ -200,7 +196,7 @@ class Stream {
explicit Stream(Fixture* f) : f_(f) {
stream_size_ = grpc_transport_stream_size(f->transport());
stream_ = gpr_malloc(stream_size_);
arena_ = grpc_core::Arena::Create(4096, g_memory_allocator);
arena_ = grpc_core::Arena::Create(4096);
}
~Stream() {
@ -216,7 +212,7 @@ class Stream {
memset(stream_, 0, stream_size_);
if ((state.iterations() & 0xffff) == 0) {
arena_->Destroy();
arena_ = grpc_core::Arena::Create(4096, g_memory_allocator);
arena_ = grpc_core::Arena::Create(4096);
}
grpc_transport_init_stream(f_->transport(),
static_cast<grpc_stream*>(stream_), &refcount_,
@ -337,7 +333,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) {
op.payload = &op_payload;
};
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
Metadata::Prepare(&b);
@ -434,7 +430,7 @@ static void BM_TransportStreamSend(benchmark::State& state) {
grpc_slice send_slice = grpc_slice_malloc_large(state.range(0));
memset(GRPC_SLICE_START_PTR(send_slice), 0, GRPC_SLICE_LENGTH(send_slice));
grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream> send_stream;
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);
@ -568,7 +564,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
op.payload = &op_payload;
};
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
auto arena = grpc_core::MakeScopedArena(1024);
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);

@ -1842,6 +1842,8 @@ src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/useful.h \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/arena.h \
src/core/lib/gprpp/atomic_utils.h \
src/core/lib/gprpp/bitset.h \
src/core/lib/gprpp/chunked_vector.h \
@ -2081,8 +2083,6 @@ src/core/lib/promise/race.h \
src/core/lib/promise/seq.h \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/api.h \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/arena.h \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/memory_quota.h \
src/core/lib/resource_quota/resource_quota.cc \

@ -1640,6 +1640,8 @@ src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/useful.h \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/README.md \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/arena.h \
src/core/lib/gprpp/atomic_utils.h \
src/core/lib/gprpp/bitset.h \
src/core/lib/gprpp/chunked_vector.h \
@ -1880,8 +1882,6 @@ src/core/lib/promise/race.h \
src/core/lib/promise/seq.h \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/api.h \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/arena.h \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/memory_quota.h \
src/core/lib/resource_quota/resource_quota.cc \

Loading…
Cancel
Save