File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 28
28
#include " opencensus/stats/stats.h"
29
29
#include " src/cpp/ext/filters/census/grpc_plugin.h"
30
30
#include " src/proto/grpc/testing/echo.grpc.pb.h"
31
+ #include " test/core/util/test_config.h"
31
32
#include " test/cpp/microbenchmarks/helpers.h"
32
33
33
34
using ::grpc::RegisterOpenCensusPlugin;
@@ -86,6 +87,8 @@ class EchoServerThread final {
86
87
};
87
88
88
89
static void BM_E2eLatencyCensusDisabled (benchmark::State& state) {
90
+ grpc::testing::TestEnvironment env (0 , {});
91
+
89
92
EchoServerThread server;
90
93
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub =
91
94
grpc::testing::EchoTestService::NewStub (grpc::CreateChannel (
@@ -101,11 +104,7 @@ static void BM_E2eLatencyCensusDisabled(benchmark::State& state) {
101
104
BENCHMARK (BM_E2eLatencyCensusDisabled);
102
105
103
106
static void BM_E2eLatencyCensusEnabled (benchmark::State& state) {
104
- // Avoid a data race between registering plugin and shutdown of previous
105
- // test (order-dependent) by doing an init/shutdown so that any previous
106
- // shutdowns are fully complete first.
107
- grpc_init ();
108
- grpc_shutdown_blocking ();
107
+ grpc::testing::TestEnvironment env (0 , {});
109
108
110
109
// Now start the test by registering the plugin (once in the execution)
111
110
RegisterOnce ();
You can’t perform that action at this time.
0 commit comments