From c010d1d18af34df5fb2a1269f47e0487ff6f8bc6 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 13 Oct 2017 10:14:29 -0700 Subject: Update benchmark according to new encoding method --- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 34 ++++++++++++----------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'test/cpp') diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 8807fa8f49..5428cc47e7 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -64,11 +64,11 @@ BENCHMARK(BM_HpackEncoderInitDestroy); static void BM_HpackEncoderEncodeDeadline(benchmark::State &state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_millis saved_now = grpc_exec_ctx_now(&exec_ctx); grpc_metadata_batch b; grpc_metadata_batch_init(&b); - b.deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(30, GPR_TIMESPAN)); + b.deadline = saved_now + 30 * 1000; grpc_chttp2_hpack_compressor c; grpc_chttp2_hpack_compressor_init(&c); @@ -280,9 +280,9 @@ class MoreRepresentativeClientInitialMetadata { static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return { GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST, - grpc_mdelem_from_slices( - exec_ctx, GRPC_MDSTR_PATH, - grpc_slice_from_static_string("/grpc.test.FooService/BarMethod")), + grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH, + grpc_slice_intern(grpc_slice_from_static_string( + "/grpc.test.FooService/BarMethod"))), grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY, grpc_slice_intern(grpc_slice_from_static_string( "foo.test.google.fr:1234"))), @@ -667,17 +667,17 @@ class MoreRepresentativeClientInitialMetadata { return {MakeSlice( {0x40, 0x07, ':', 's', 'c', 'h', 'e', 'm', 'e', 0x04, 'h', 't', 't', 'p', 0x40, 0x07, ':', 'm', 'e', 't', 'h', 'o', 'd', 0x04, - 'P', 'O', 'S', 'T', 0x00, 0x05, ':', 'p', 'a', 't', 'h', 0x1f, + 'P', 'O', 'S', 'T', 0x40, 0x05, ':', 'p', 'a', 't', 'h', 0x1f, '/', 'g', 'r', 'p', 'c', '.', 't', 'e', 's', 't', '.', 'F', 'o', 'o', 'S', 'e', 'r', 'v', 'i', 'c', 'e', '/', 'B', 'a', 'r', 'M', 'e', 't', 'h', 'o', 'd', 0x40, 0x0a, ':', 'a', 'u', 't', 'h', 'o', 'r', 'i', 't', 'y', 0x09, 'l', 'o', 'c', 'a', - 'l', 'h', 'o', 's', 't', 0x00, 0x0e, 'g', 'r', 'p', 'c', '-', + 'l', 'h', 'o', 's', 't', 0x40, 0x0e, 'g', 'r', 'p', 'c', '-', 't', 'r', 'a', 'c', 'e', '-', 'b', 'i', 'n', 0x31, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, - 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x00, + 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x40, 0x0d, 'g', 'r', 'p', 'c', '-', 't', 'a', 'g', 's', '-', 'b', 'i', 'n', 0x14, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x40, @@ -696,19 +696,13 @@ class MoreRepresentativeClientInitialMetadata { } static std::vector GetBenchmarkSlices() { return {MakeSlice( - {0xc4, 0xc3, 0x00, 0x05, ':', 'p', 'a', 't', 'h', 0x1f, '/', 'g', - 'r', 'p', 'c', '.', 't', 'e', 's', 't', '.', 'F', 'o', 'o', - 'S', 'e', 'r', 'v', 'i', 'c', 'e', '/', 'B', 'a', 'r', 'M', - 'e', 't', 'h', 'o', 'd', 0xc2, 0x00, 0x0e, 'g', 'r', 'p', 'c', - '-', 't', 'r', 'a', 'c', 'e', '-', 'b', 'i', 'n', 0x31, 0x00, + {0xc7, 0xc6, 0xc5, 0xc4, 0x7f, 0x04, 0x31, 0x00, 0x01, 0x02, 0x03, 0x04, + 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, + 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x7f, 0x03, 0x14, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, - 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, - 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x00, 0x0d, 'g', 'r', 'p', 'c', '-', 't', 'a', 'g', 's', '-', - 'b', 'i', 'n', 0x14, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, - 0xc1, 0xc0, 0xbf, 0xbe})}; + 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0xc1, 0xc0, 0xbf, 0xbe})}; } }; -- cgit v1.2.3