/* This benchmark exists to ensure that immediately-firing alarms are fast */
#include <benchmark/benchmark.h>
+
#include <grpc/grpc.h>
#include <grpcpp/alarm.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/grpc_library.h>
+
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
-auto& force_library_initialization = Library::get();
-
static void BM_Alarm_Tag_Immediate(benchmark::State& state) {
TrackCounters track_counters;
CompletionQueue cq;
void* output_tag;
bool ok;
auto deadline = grpc_timeout_seconds_to_deadline(0);
- while (state.KeepRunning()) {
+ for (auto _ : state) {
alarm.Set(&cq, deadline, nullptr);
cq.Next(&output_tag, &ok);
}
} // namespace benchmark
int main(int argc, char** argv) {
+ grpc::testing::TestEnvironment env(argc, argv);
+ LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);
benchmark::RunTheBenchmarksNamespaced();