Go to the documentation of this file.
27 #include <benchmark/benchmark.h>
174 explicit C(
const F&
f) : f_(
f) {
182 return std::unique_ptr<TestClosure>(
new C(
f));
188 explicit C(
const F&
f) : f_(
f) {}
192 delete static_cast<C*
>(
arg);
218 if ((
state.iterations() & 0xffff) == 0) {
250 stream->destroy_closure_);
276 op.cancel_stream =
true;
277 op.payload = &op_payload;
279 std::unique_ptr<TestClosure>
next =
281 if (!
state.KeepRunning()) {
287 s->DestroyThen(
next.get());
304 "/foo/bar/bm_chttp2_transport")));
307 "foo.test.google.fr:1234")));
317 "grpc-c/3.0.0-dev (linux; chttp2; green)")));
321 template <
class Metadata>
329 std::unique_ptr<TestClosure>
start;
330 std::unique_ptr<TestClosure>
done;
332 auto reset_op = [&]() {
334 op.payload = &op_payload;
339 Metadata::Prepare(&
b);
345 if (!
state.KeepRunning()) {
347 gpr_event_set(&bm_done, (void*)1);
352 op.on_complete =
done.get();
353 op.send_initial_metadata =
true;
354 op.payload->send_initial_metadata.send_initial_metadata = &
b;
359 op.cancel_stream =
true;
362 s->DestroyThen(
start.get());
380 auto reset_op = [&]() {
382 op.payload = &op_payload;
384 std::unique_ptr<TestClosure>
c =
386 if (!
state.KeepRunning())
return;
388 op.on_complete =
c.get();
394 op.cancel_stream =
true;
398 std::unique_ptr<TestClosure> stream_cancel_closure =
401 gpr_event_set(stream_cancel_done,
reinterpret_cast<void*
>(1));
403 op.on_complete = stream_cancel_closure.get();
421 int main(
int argc,
char** argv) {
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
void InitTest(int *argc, char ***argv, bool remove_flags)
ScopedArenaPtr MakeScopedArena(size_t initial_size, MemoryAllocator *memory_allocator)
static Arena * Create(size_t initial_size, MemoryAllocator *memory_allocator)
return memset(p, 0, total)
grpc_transport * transport()
grpc_transport * grpc_create_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client)
void PushInput(grpc_slice slice)
static void read(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool, int)
struct grpc_pollset_set grpc_pollset_set
static StaticSlice FromStaticString(const char *s)
GPRAPI void gpr_event_set(gpr_event *ev, void *value)
GPRAPI void gpr_free(void *ptr)
const grpc_endpoint_vtable * vtable
GPRAPI void * gpr_malloc(size_t size)
BENCHMARK(BM_StreamCreateDestroy)
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
static int get_fd(grpc_endpoint *)
BENCHMARK_TEMPLATE(BM_StreamCreateSendInitialMetadataDestroy, RepresentativeClientInitialMetadata)
void RunTheBenchmarksNamespaced()
grpc_closure * destroy_closure_
virtual void Finish(benchmark::State &state)
#define GRPC_ERROR_CANCELLED
static void FinishDestroy(void *arg, grpc_error_handle)
void grpc_transport_perform_stream_op(grpc_transport *transport, grpc_stream *stream, grpc_transport_stream_op_batch *op)
grpc_core::ScopedArenaPtr arena
static void BM_TransportEmptyOp(benchmark::State &state)
size_t RunSpecifiedBenchmarks()
grpc_slice buffered_slice_
void Init(benchmark::State &state)
static void shutdown(grpc_endpoint *ep, grpc_error_handle why)
std::vector< std::unique_ptr< gpr_event > > done_events
void DestroyThen(grpc_closure *closure)
static void destroy(grpc_endpoint *ep)
static const CoreConfiguration & Get()
void grpc_transport_destroy(grpc_transport *transport)
grpc_error_handle cancel_error
static void delete_from_pollset_set(grpc_endpoint *, grpc_pollset_set *)
static auto * g_memory_allocator
void QueueRead(grpc_slice_buffer *slices, grpc_closure *cb)
const grpc_channel_args * ToC() const
void grpc_channel_args_destroy(grpc_channel_args *a)
grpc_chttp2_stream * chttp2_stream()
static void add_to_pollset(grpc_endpoint *, grpc_pollset *)
void PushInput(grpc_slice slice)
static ResourceQuotaRefPtr Default()
GPRAPI void gpr_event_init(gpr_event *ev)
void Initialize(int *argc, char **argv)
grpc_slice_buffer * slices_
const ChannelArgsPreconditioning & channel_args_preconditioning() const
GPRAPI void * gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline)
void Op(grpc_transport_stream_op_batch *op)
int main(int argc, char **argv)
grpc_closure * MakeOnceClosure(F f)
static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State &state)
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
grpc_chttp2_transport * chttp2_transport()
size_t grpc_transport_stream_size(grpc_transport *transport)
static void write(grpc_endpoint *, grpc_slice_buffer *, grpc_closure *cb, void *, int)
grpc_core::ExecCtx exec_ctx
static absl::string_view get_peer(grpc_endpoint *)
std::unique_ptr< TestClosure > MakeTestClosure(F f)
AllocList * next[kMaxLevel]
grpc_stream_refcount refcount_
static bool can_track_err(grpc_endpoint *)
static absl::string_view get_local_address(grpc_endpoint *)
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
#define GRPC_STREAM_REF_INIT(rc, ir, cb, cb_arg, objtype)
struct grpc_stream grpc_stream
grpc_core::Arena * arena_
static void add_to_pollset_set(grpc_endpoint *, grpc_pollset_set *)
void grpc_transport_destroy_stream(grpc_transport *transport, grpc_stream *stream, grpc_closure *then_schedule_closure)
static void BM_StreamCreateDestroy(benchmark::State &state)
void grpc_stream_unref(grpc_stream_refcount *refcount, const char *reason)
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
int grpc_transport_init_stream(grpc_transport *transport, grpc_stream *stream, grpc_stream_refcount *refcount, const void *server_data, grpc_core::Arena *arena)
ChannelArgs PreconditionChannelArgs(const grpc_channel_args *args) const
void grpc_chttp2_transport_start_reading(grpc_transport *transport, grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings, grpc_closure *notify_on_close)
OPENSSL_EXPORT pem_password_cb * cb
struct grpc_transport_stream_op_batch_payload::@46 cancel_stream
#define GRPC_ERROR_IS_NONE(err)
Fixture(const grpc::ChannelArguments &args, bool client)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:48