benchmark/src/benchmark.cc
Go to the documentation of this file.
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "benchmark/benchmark.h"
16 
17 #include "benchmark_api_internal.h"
18 #include "benchmark_runner.h"
19 #include "internal_macros.h"
20 
21 #ifndef BENCHMARK_OS_WINDOWS
22 #ifndef BENCHMARK_OS_FUCHSIA
23 #include <sys/resource.h>
24 #endif
25 #include <sys/time.h>
26 #include <unistd.h>
27 #endif
28 
29 #include <algorithm>
30 #include <atomic>
31 #include <condition_variable>
32 #include <cstdio>
33 #include <cstdlib>
34 #include <fstream>
35 #include <iostream>
36 #include <limits>
37 #include <map>
38 #include <memory>
39 #include <random>
40 #include <string>
41 #include <thread>
42 #include <utility>
43 
44 #include "check.h"
45 #include "colorprint.h"
46 #include "commandlineflags.h"
47 #include "complexity.h"
48 #include "counter.h"
49 #include "internal_macros.h"
50 #include "log.h"
51 #include "mutex.h"
52 #include "perf_counters.h"
53 #include "re.h"
54 #include "statistics.h"
55 #include "string_util.h"
56 #include "thread_manager.h"
57 #include "thread_timer.h"
58 
59 namespace benchmark {
60 // Print a list of benchmarks. This option overrides all other options.
61 BM_DEFINE_bool(benchmark_list_tests, false);
62 
63 // A regular expression that specifies the set of benchmarks to execute. If
64 // this flag is empty, or if this flag is the string \"all\", all benchmarks
65 // linked into the binary are run.
66 BM_DEFINE_string(benchmark_filter, "");
67 
68 // Minimum number of seconds we should run benchmark before results are
69 // considered significant. For cpu-time based tests, this is the lower bound
70 // on the total cpu time used by all threads that make up the test. For
71 // real-time based tests, this is the lower bound on the elapsed time of the
72 // benchmark execution, regardless of number of threads.
73 BM_DEFINE_double(benchmark_min_time, 0.5);
74 
75 // The number of runs of each benchmark. If greater than 1, the mean and
76 // standard deviation of the runs will be reported.
77 BM_DEFINE_int32(benchmark_repetitions, 1);
78 
79 // If set, enable random interleaving of repetitions of all benchmarks.
80 // See http://github.com/google/benchmark/issues/1051 for details.
81 BM_DEFINE_bool(benchmark_enable_random_interleaving, false);
82 
83 // Report the result of each benchmark repetitions. When 'true' is specified
84 // only the mean, standard deviation, and other statistics are reported for
85 // repeated benchmarks. Affects all reporters.
86 BM_DEFINE_bool(benchmark_report_aggregates_only, false);
87 
88 // Display the result of each benchmark repetitions. When 'true' is specified
89 // only the mean, standard deviation, and other statistics are displayed for
90 // repeated benchmarks. Unlike benchmark_report_aggregates_only, only affects
91 // the display reporter, but *NOT* file reporter, which will still contain
92 // all the output.
93 BM_DEFINE_bool(benchmark_display_aggregates_only, false);
94 
95 // The format to use for console output.
96 // Valid values are 'console', 'json', or 'csv'.
97 BM_DEFINE_string(benchmark_format, "console");
98 
99 // The format to use for file output.
100 // Valid values are 'console', 'json', or 'csv'.
101 BM_DEFINE_string(benchmark_out_format, "json");
102 
103 // The file to write additional output to.
104 BM_DEFINE_string(benchmark_out, "");
105 
106 // Whether to use colors in the output. Valid values:
107 // 'true'/'yes'/1, 'false'/'no'/0, and 'auto'. 'auto' means to use colors if
108 // the output is being sent to a terminal and the TERM environment variable is
109 // set to a terminal type that supports colors.
110 BM_DEFINE_string(benchmark_color, "auto");
111 
112 // Whether to use tabular format when printing user counters to the console.
113 // Valid values: 'true'/'yes'/1, 'false'/'no'/0. Defaults to false.
114 BM_DEFINE_bool(benchmark_counters_tabular, false);
115 
116 // List of additional perf counters to collect, in libpfm format. For more
117 // information about libpfm: https://man7.org/linux/man-pages/man3/libpfm.3.html
118 BM_DEFINE_string(benchmark_perf_counters, "");
119 
120 // Extra context to include in the output formatted as comma-separated key-value
121 // pairs. Kept internal as it's only used for parsing from env/command line.
122 BM_DEFINE_kvpairs(benchmark_context, {});
123 
124 // The level of verbose logging to output
125 BM_DEFINE_int32(v, 0);
126 
127 namespace internal {
128 
129 std::map<std::string, std::string>* global_context = nullptr;
130 
131 // FIXME: wouldn't LTO mess this up?
132 void UseCharPointer(char const volatile*) {}
133 
134 } // namespace internal
135 
136 State::State(IterationCount max_iters, const std::vector<int64_t>& ranges,
137  int thread_i, int n_threads, internal::ThreadTimer* timer,
138  internal::ThreadManager* manager,
139  internal::PerfCountersMeasurement* perf_counters_measurement)
140  : total_iterations_(0),
141  batch_leftover_(0),
142  max_iterations(max_iters),
143  started_(false),
144  finished_(false),
145  error_occurred_(false),
146  range_(ranges),
147  complexity_n_(0),
148  counters(),
149  thread_index_(thread_i),
150  threads_(n_threads),
151  timer_(timer),
152  manager_(manager),
153  perf_counters_measurement_(perf_counters_measurement) {
154  BM_CHECK(max_iterations != 0) << "At least one iteration must be run";
156  << "thread_index must be less than threads";
157 
158  // Note: The use of offsetof below is technically undefined until C++17
159  // because State is not a standard layout type. However, all compilers
160  // currently provide well-defined behavior as an extension (which is
161  // demonstrated since constexpr evaluation must diagnose all undefined
162  // behavior). However, GCC and Clang also warn about this use of offsetof,
163  // which must be suppressed.
164 #if defined(__INTEL_COMPILER)
165 #pragma warning push
166 #pragma warning(disable : 1875)
167 #elif defined(__GNUC__)
168 #pragma GCC diagnostic push
169 #pragma GCC diagnostic ignored "-Winvalid-offsetof"
170 #endif
171  // Offset tests to ensure commonly accessed data is on the first cache line.
172  const int cache_line_size = 64;
173  static_assert(offsetof(State, error_occurred_) <=
174  (cache_line_size - sizeof(error_occurred_)),
175  "");
176 #if defined(__INTEL_COMPILER)
177 #pragma warning pop
178 #elif defined(__GNUC__)
179 #pragma GCC diagnostic pop
180 #endif
181 }
182 
184  // Add in time accumulated so far
186  timer_->StopTimer();
188  auto measurements = perf_counters_measurement_->StopAndGetMeasurements();
189  for (const auto& name_and_measurement : measurements) {
190  auto name = name_and_measurement.first;
191  auto measurement = name_and_measurement.second;
192  BM_CHECK_EQ(counters[name], 0.0);
193  counters[name] = Counter(measurement, Counter::kAvgIterations);
194  }
195  }
196 }
197 
200  timer_->StartTimer();
203  }
204 }
205 
206 void State::SkipWithError(const char* msg) {
207  BM_CHECK(msg);
208  error_occurred_ = true;
209  {
211  if (manager_->results.has_error_ == false) {
212  manager_->results.error_message_ = msg;
213  manager_->results.has_error_ = true;
214  }
215  }
216  total_iterations_ = 0;
217  if (timer_->running()) timer_->StopTimer();
218 }
219 
222 }
223 
224 void State::SetLabel(const char* label) {
226  manager_->results.report_label_ = label;
227 }
228 
231  started_ = true;
235 }
236 
239  if (!error_occurred_) {
240  PauseTiming();
241  }
242  // Total iterations has now wrapped around past 0. Fix this.
243  total_iterations_ = 0;
244  finished_ = true;
246 }
247 
248 namespace internal {
249 namespace {
250 
251 // Flushes streams after invoking reporter methods that write to them. This
252 // ensures users get timely updates even when streams are not line-buffered.
253 void FlushStreams(BenchmarkReporter* reporter) {
254  if (!reporter) return;
255  std::flush(reporter->GetOutputStream());
256  std::flush(reporter->GetErrorStream());
257 }
258 
259 // Reports in both display and file reporters.
260 void Report(BenchmarkReporter* display_reporter,
261  BenchmarkReporter* file_reporter, const RunResults& run_results) {
262  auto report_one = [](BenchmarkReporter* reporter, bool aggregates_only,
263  const RunResults& results) {
264  assert(reporter);
265  // If there are no aggregates, do output non-aggregates.
266  aggregates_only &= !results.aggregates_only.empty();
267  if (!aggregates_only) reporter->ReportRuns(results.non_aggregates);
268  if (!results.aggregates_only.empty())
269  reporter->ReportRuns(results.aggregates_only);
270  };
271 
272  report_one(display_reporter, run_results.display_report_aggregates_only,
273  run_results);
274  if (file_reporter)
275  report_one(file_reporter, run_results.file_report_aggregates_only,
276  run_results);
277 
278  FlushStreams(display_reporter);
279  FlushStreams(file_reporter);
280 }
281 
282 void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
283  BenchmarkReporter* display_reporter,
284  BenchmarkReporter* file_reporter) {
285  // Note the file_reporter can be null.
286  BM_CHECK(display_reporter != nullptr);
287 
288  // Determine the width of the name field using a minimum width of 10.
289  bool might_have_aggregates = FLAGS_benchmark_repetitions > 1;
290  size_t name_field_width = 10;
291  size_t stat_field_width = 0;
292  for (const BenchmarkInstance& benchmark : benchmarks) {
293  name_field_width =
294  std::max<size_t>(name_field_width, benchmark.name().str().size());
295  might_have_aggregates |= benchmark.repetitions() > 1;
296 
297  for (const auto& Stat : benchmark.statistics())
298  stat_field_width = std::max<size_t>(stat_field_width, Stat.name_.size());
299  }
300  if (might_have_aggregates) name_field_width += 1 + stat_field_width;
301 
302  // Print header here
303  BenchmarkReporter::Context context;
304  context.name_field_width = name_field_width;
305 
306  // Keep track of running times of all instances of each benchmark family.
307  std::map<int /*family_index*/, BenchmarkReporter::PerFamilyRunReports>
308  per_family_reports;
309 
310  if (display_reporter->ReportContext(context) &&
311  (!file_reporter || file_reporter->ReportContext(context))) {
312  FlushStreams(display_reporter);
313  FlushStreams(file_reporter);
314 
315  size_t num_repetitions_total = 0;
316 
317  std::vector<internal::BenchmarkRunner> runners;
318  runners.reserve(benchmarks.size());
319  for (const BenchmarkInstance& benchmark : benchmarks) {
320  BenchmarkReporter::PerFamilyRunReports* reports_for_family = nullptr;
321  if (benchmark.complexity() != oNone)
322  reports_for_family = &per_family_reports[benchmark.family_index()];
323 
324  runners.emplace_back(benchmark, reports_for_family);
325  int num_repeats_of_this_instance = runners.back().GetNumRepeats();
326  num_repetitions_total += num_repeats_of_this_instance;
327  if (reports_for_family)
328  reports_for_family->num_runs_total += num_repeats_of_this_instance;
329  }
330  assert(runners.size() == benchmarks.size() && "Unexpected runner count.");
331 
332  std::vector<size_t> repetition_indices;
333  repetition_indices.reserve(num_repetitions_total);
334  for (size_t runner_index = 0, num_runners = runners.size();
335  runner_index != num_runners; ++runner_index) {
336  const internal::BenchmarkRunner& runner = runners[runner_index];
337  std::fill_n(std::back_inserter(repetition_indices),
338  runner.GetNumRepeats(), runner_index);
339  }
340  assert(repetition_indices.size() == num_repetitions_total &&
341  "Unexpected number of repetition indexes.");
342 
343  if (FLAGS_benchmark_enable_random_interleaving) {
344  std::random_device rd;
345  std::mt19937 g(rd());
346  std::shuffle(repetition_indices.begin(), repetition_indices.end(), g);
347  }
348 
349  for (size_t repetition_index : repetition_indices) {
350  internal::BenchmarkRunner& runner = runners[repetition_index];
351  runner.DoOneRepetition();
352  if (runner.HasRepeatsRemaining()) continue;
353  // FIXME: report each repetition separately, not all of them in bulk.
354 
355  RunResults run_results = runner.GetResults();
356 
357  // Maybe calculate complexity report
358  if (const auto* reports_for_family = runner.GetReportsForFamily()) {
359  if (reports_for_family->num_runs_done ==
360  reports_for_family->num_runs_total) {
361  auto additional_run_stats = ComputeBigO(reports_for_family->Runs);
362  run_results.aggregates_only.insert(run_results.aggregates_only.end(),
363  additional_run_stats.begin(),
364  additional_run_stats.end());
365  per_family_reports.erase(
366  (int)reports_for_family->Runs.front().family_index);
367  }
368  }
369 
370  Report(display_reporter, file_reporter, run_results);
371  }
372  }
373  display_reporter->Finalize();
374  if (file_reporter) file_reporter->Finalize();
375  FlushStreams(display_reporter);
376  FlushStreams(file_reporter);
377 }
378 
379 // Disable deprecated warnings temporarily because we need to reference
380 // CSVReporter but don't want to trigger -Werror=-Wdeprecated-declarations
381 #ifdef __GNUC__
382 #pragma GCC diagnostic push
383 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
384 #endif
385 
386 std::unique_ptr<BenchmarkReporter> CreateReporter(
387  std::string const& name, ConsoleReporter::OutputOptions output_opts) {
388  typedef std::unique_ptr<BenchmarkReporter> PtrType;
389  if (name == "console") {
390  return PtrType(new ConsoleReporter(output_opts));
391  } else if (name == "json") {
392  return PtrType(new JSONReporter);
393  } else if (name == "csv") {
394  return PtrType(new CSVReporter);
395  } else {
396  std::cerr << "Unexpected format: '" << name << "'\n";
397  std::exit(1);
398  }
399 }
400 
401 #ifdef __GNUC__
402 #pragma GCC diagnostic pop
403 #endif
404 
405 } // end namespace
406 
407 bool IsZero(double n) {
408  return std::abs(n) < std::numeric_limits<double>::epsilon();
409 }
410 
412  int output_opts = ConsoleReporter::OO_Defaults;
413  auto is_benchmark_color = [force_no_color]() -> bool {
414  if (force_no_color) {
415  return false;
416  }
417  if (FLAGS_benchmark_color == "auto") {
418  return IsColorTerminal();
419  }
420  return IsTruthyFlagValue(FLAGS_benchmark_color);
421  };
422  if (is_benchmark_color()) {
423  output_opts |= ConsoleReporter::OO_Color;
424  } else {
425  output_opts &= ~ConsoleReporter::OO_Color;
426  }
427  if (FLAGS_benchmark_counters_tabular) {
428  output_opts |= ConsoleReporter::OO_Tabular;
429  } else {
430  output_opts &= ~ConsoleReporter::OO_Tabular;
431  }
432  return static_cast<ConsoleReporter::OutputOptions>(output_opts);
433 }
434 
435 } // end namespace internal
436 
438  return RunSpecifiedBenchmarks(nullptr, nullptr);
439 }
440 
441 size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter) {
442  return RunSpecifiedBenchmarks(display_reporter, nullptr);
443 }
444 
445 size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
446  BenchmarkReporter* file_reporter) {
447  std::string spec = FLAGS_benchmark_filter;
448  if (spec.empty() || spec == "all")
449  spec = "."; // Regexp that matches all benchmarks
450 
451  // Setup the reporters
452  std::ofstream output_file;
453  std::unique_ptr<BenchmarkReporter> default_display_reporter;
454  std::unique_ptr<BenchmarkReporter> default_file_reporter;
455  if (!display_reporter) {
456  default_display_reporter = internal::CreateReporter(
457  FLAGS_benchmark_format, internal::GetOutputOptions());
458  display_reporter = default_display_reporter.get();
459  }
460  auto& Out = display_reporter->GetOutputStream();
461  auto& Err = display_reporter->GetErrorStream();
462 
463  std::string const& fname = FLAGS_benchmark_out;
464  if (fname.empty() && file_reporter) {
465  Err << "A custom file reporter was provided but "
466  "--benchmark_out=<file> was not specified."
467  << std::endl;
468  std::exit(1);
469  }
470  if (!fname.empty()) {
471  output_file.open(fname);
472  if (!output_file.is_open()) {
473  Err << "invalid file name: '" << fname << "'" << std::endl;
474  std::exit(1);
475  }
476  if (!file_reporter) {
477  default_file_reporter = internal::CreateReporter(
478  FLAGS_benchmark_out_format, ConsoleReporter::OO_None);
479  file_reporter = default_file_reporter.get();
480  }
481  file_reporter->SetOutputStream(&output_file);
482  file_reporter->SetErrorStream(&output_file);
483  }
484 
485  std::vector<internal::BenchmarkInstance> benchmarks;
486  if (!FindBenchmarksInternal(spec, &benchmarks, &Err)) return 0;
487 
488  if (benchmarks.empty()) {
489  Err << "Failed to match any benchmarks against regex: " << spec << "\n";
490  return 0;
491  }
492 
493  if (FLAGS_benchmark_list_tests) {
494  for (auto const& benchmark : benchmarks)
495  Out << benchmark.name().str() << "\n";
496  } else {
497  internal::RunBenchmarks(benchmarks, display_reporter, file_reporter);
498  }
499 
500  return benchmarks.size();
501 }
502 
504  internal::memory_manager = manager;
505 }
506 
508  if (internal::global_context == nullptr) {
509  internal::global_context = new std::map<std::string, std::string>();
510  }
511  if (!internal::global_context->emplace(key, value).second) {
512  std::cerr << "Failed to add custom context \"" << key << "\" as it already "
513  << "exists with value \"" << value << "\"\n";
514  }
515 }
516 
517 namespace internal {
518 
520  fprintf(stdout,
521  "benchmark"
522  " [--benchmark_list_tests={true|false}]\n"
523  " [--benchmark_filter=<regex>]\n"
524  " [--benchmark_min_time=<min_time>]\n"
525  " [--benchmark_repetitions=<num_repetitions>]\n"
526  " [--benchmark_enable_random_interleaving={true|false}]\n"
527  " [--benchmark_report_aggregates_only={true|false}]\n"
528  " [--benchmark_display_aggregates_only={true|false}]\n"
529  " [--benchmark_format=<console|json|csv>]\n"
530  " [--benchmark_out=<filename>]\n"
531  " [--benchmark_out_format=<json|console|csv>]\n"
532  " [--benchmark_color={auto|true|false}]\n"
533  " [--benchmark_counters_tabular={true|false}]\n"
534  " [--benchmark_perf_counters=<counter>,...]\n"
535  " [--benchmark_context=<key>=<value>,...]\n"
536  " [--v=<verbosity>]\n");
537  exit(0);
538 }
539 
540 void ParseCommandLineFlags(int* argc, char** argv) {
541  using namespace benchmark;
543  (argc && *argc > 0) ? argv[0] : "unknown";
544  for (int i = 1; argc && i < *argc; ++i) {
545  if (ParseBoolFlag(argv[i], "benchmark_list_tests",
546  &FLAGS_benchmark_list_tests) ||
547  ParseStringFlag(argv[i], "benchmark_filter", &FLAGS_benchmark_filter) ||
548  ParseDoubleFlag(argv[i], "benchmark_min_time",
549  &FLAGS_benchmark_min_time) ||
550  ParseInt32Flag(argv[i], "benchmark_repetitions",
551  &FLAGS_benchmark_repetitions) ||
552  ParseBoolFlag(argv[i], "benchmark_enable_random_interleaving",
553  &FLAGS_benchmark_enable_random_interleaving) ||
554  ParseBoolFlag(argv[i], "benchmark_report_aggregates_only",
555  &FLAGS_benchmark_report_aggregates_only) ||
556  ParseBoolFlag(argv[i], "benchmark_display_aggregates_only",
557  &FLAGS_benchmark_display_aggregates_only) ||
558  ParseStringFlag(argv[i], "benchmark_format", &FLAGS_benchmark_format) ||
559  ParseStringFlag(argv[i], "benchmark_out", &FLAGS_benchmark_out) ||
560  ParseStringFlag(argv[i], "benchmark_out_format",
561  &FLAGS_benchmark_out_format) ||
562  ParseStringFlag(argv[i], "benchmark_color", &FLAGS_benchmark_color) ||
563  // "color_print" is the deprecated name for "benchmark_color".
564  // TODO: Remove this.
565  ParseStringFlag(argv[i], "color_print", &FLAGS_benchmark_color) ||
566  ParseBoolFlag(argv[i], "benchmark_counters_tabular",
567  &FLAGS_benchmark_counters_tabular) ||
568  ParseStringFlag(argv[i], "benchmark_perf_counters",
569  &FLAGS_benchmark_perf_counters) ||
570  ParseKeyValueFlag(argv[i], "benchmark_context",
571  &FLAGS_benchmark_context) ||
572  ParseInt32Flag(argv[i], "v", &FLAGS_v)) {
573  for (int j = i; j != *argc - 1; ++j) argv[j] = argv[j + 1];
574 
575  --(*argc);
576  --i;
577  } else if (IsFlag(argv[i], "help")) {
579  }
580  }
581  for (auto const* flag :
582  {&FLAGS_benchmark_format, &FLAGS_benchmark_out_format}) {
583  if (*flag != "console" && *flag != "json" && *flag != "csv") {
585  }
586  }
587  if (FLAGS_benchmark_color.empty()) {
589  }
590  for (const auto& kv : FLAGS_benchmark_context) {
591  AddCustomContext(kv.first, kv.second);
592  }
593 }
594 
596  static std::ios_base::Init init;
597  return 0;
598 }
599 
600 } // end namespace internal
601 
602 void Initialize(int* argc, char** argv) {
604  internal::LogLevel() = FLAGS_v;
605 }
606 
607 void Shutdown() {
609 }
610 
611 bool ReportUnrecognizedArguments(int argc, char** argv) {
612  for (int i = 1; i < argc; ++i) {
613  fprintf(stderr, "%s: error: unrecognized command-line flag: %s\n", argv[0],
614  argv[i]);
615  }
616  return argc > 1;
617 }
618 
619 } // end namespace benchmark
thread_timer.h
benchmark::internal::ThreadTimer::SetIterationTime
void SetIterationTime(double seconds)
Definition: thread_timer.h:41
benchmark::BenchmarkReporter::GetErrorStream
std::ostream & GetErrorStream() const
Definition: benchmark/include/benchmark/benchmark.h:1555
log.h
benchmarks
static Benchmark * benchmarks[10000]
Definition: bloaty/third_party/re2/util/benchmark.cc:25
absl::time_internal::cctz::seconds
std::chrono::duration< std::int_fast64_t > seconds
Definition: abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h:40
flag
uint32_t flag
Definition: ssl_versions.cc:162
threads_
std::vector< grpc_core::Thread > threads_
Definition: event_engine/iomgr_engine/timer_manager.cc:52
benchmark::State::threads_
const int threads_
Definition: benchmark/include/benchmark/benchmark.h:731
benchmark::State::manager_
internal::ThreadManager *const manager_
Definition: benchmark/include/benchmark/benchmark.h:734
timer_
grpc_timer timer_
Definition: channel_connectivity.cc:218
benchmark::MemoryManager
Definition: benchmark/include/benchmark/benchmark.h:1629
init
const char * init
Definition: upb/upb/bindings/lua/main.c:49
benchmark::BenchmarkReporter::SetErrorStream
void SetErrorStream(std::ostream *err)
Definition: benchmark/include/benchmark/benchmark.h:1548
check.h
benchmark::oNone
@ oNone
Definition: benchmark/include/benchmark/benchmark.h:449
benchmark::State::max_iterations
const IterationCount max_iterations
Definition: benchmark/include/benchmark/benchmark.h:702
benchmark
Definition: bm_alarm.cc:55
benchmark::internal::PerfCountersMeasurement
Definition: perf_counters.h:125
benchmarks
Definition: third_party/bloaty/third_party/protobuf/benchmarks/__init__.py:1
benchmark::internal::IsZero
bool IsZero(double n)
Definition: benchmark/src/benchmark.cc:407
demumble_test.stdout
stdout
Definition: demumble_test.py:38
benchmark::RegisterMemoryManager
void RegisterMemoryManager(MemoryManager *memory_manager)
Definition: benchmark/src/benchmark.cc:503
benchmark::internal::ThreadTimer
Definition: thread_timer.h:10
false
#define false
Definition: setup_once.h:323
BM_CHECK
#define BM_CHECK(b)
Definition: benchmark/src/check.h:58
benchmark::ConsoleReporter::OO_Tabular
@ OO_Tabular
Definition: benchmark/include/benchmark/benchmark.h:1576
_gevent_test_main.runner
runner
Definition: _gevent_test_main.py:94
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
benchmark::internal::LogLevel
int & LogLevel()
Definition: third_party/benchmark/src/log.h:44
benchmark::State::SkipWithError
void SkipWithError(const char *msg)
Definition: benchmark/src/benchmark.cc:206
google::protobuf::python::cmessage::Init
static int Init(CMessage *self, PyObject *args, PyObject *kwargs)
Definition: bloaty/third_party/protobuf/python/google/protobuf/pyext/message.cc:1287
setup.name
name
Definition: setup.py:542
benchmark::BenchmarkReporter::Context::executable_name
static const char * executable_name
Definition: benchmark/include/benchmark/benchmark.h:1419
benchmark::internal::ThreadManager::GetBenchmarkMutex
Mutex & GetBenchmarkMutex() const RETURN_CAPABILITY(benchmark_mutex_)
Definition: third_party/benchmark/src/thread_manager.h:17
benchmark::State::total_iterations_
IterationCount total_iterations_
Definition: benchmark/include/benchmark/benchmark.h:694
colorprint.h
mutex.h
second
StrT second
Definition: cxa_demangle.cpp:4885
benchmark::State::SetLabel
void SetLabel(const char *label)
Definition: benchmark/src/benchmark.cc:224
benchmark_api_internal.h
benchmark::State::counters
UserCounters counters
Definition: benchmark/include/benchmark/benchmark.h:716
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:480
statistics.h
benchmark::internal::ThreadTimer::StopTimer
void StopTimer()
Definition: thread_timer.h:30
run_interop_tests.spec
def spec
Definition: run_interop_tests.py:1394
benchmark_runner.h
benchmark::State::started_
bool started_
Definition: benchmark/include/benchmark/benchmark.h:705
python_utils.port_server.stderr
stderr
Definition: port_server.py:51
perf_counters.h
benchmark::State::timer_
internal::ThreadTimer *const timer_
Definition: benchmark/include/benchmark/benchmark.h:733
benchmark::internal::ThreadTimer::StartTimer
void StartTimer()
Definition: thread_timer.h:23
benchmark::RunSpecifiedBenchmarks
size_t RunSpecifiedBenchmarks()
Definition: benchmark/src/benchmark.cc:437
benchmark::ParseDoubleFlag
bool ParseDoubleFlag(const char *str, const char *flag, double *value)
Definition: benchmark/src/commandlineflags.cc:228
BM_CHECK_LT
#define BM_CHECK_LT(a, b)
Definition: benchmark/src/check.h:73
benchmark::internal::GetOutputOptions
ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color)
Definition: benchmark/src/benchmark.cc:411
benchmark::ParseStringFlag
bool ParseStringFlag(const char *str, const char *flag, std::string *value)
Definition: benchmark/src/commandlineflags.cc:240
benchmark::IsTruthyFlagValue
bool IsTruthyFlagValue(const std::string &value)
Definition: benchmark/src/commandlineflags.cc:271
gen_synthetic_protos.label
label
Definition: gen_synthetic_protos.py:102
benchmark::IterationCount
uint64_t IterationCount
Definition: benchmark/include/benchmark/benchmark.h:451
benchmark::ConsoleReporter::OutputOptions
OutputOptions
Definition: benchmark/include/benchmark/benchmark.h:1573
setup.v
v
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:42
benchmark::State::StartKeepRunning
void StartKeepRunning()
Definition: benchmark/src/benchmark.cc:229
benchmarks.python.py_benchmark.results
list results
Definition: bloaty/third_party/protobuf/benchmarks/python/py_benchmark.py:145
benchmark::ComputeBigO
std::vector< BenchmarkReporter::Run > ComputeBigO(const std::vector< BenchmarkReporter::Run > &reports)
Definition: benchmark/src/complexity.cc:156
range_
string_view range_
Definition: elf.cc:94
benchmark::internal::ThreadTimer::running
bool running() const
Definition: thread_timer.h:43
testing::internal::posix::Stat
int Stat(const char *path, StatStruct *buf)
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2008
benchmark::BM_DEFINE_string
BM_DEFINE_string(benchmark_filter, "")
started_
bool started_
Definition: xds_cluster_impl.cc:357
counter.h
benchmark::Initialize
void Initialize(int *argc, char **argv)
Definition: benchmark/src/benchmark.cc:602
benchmark::ConsoleReporter::OO_Defaults
@ OO_Defaults
Definition: benchmark/include/benchmark/benchmark.h:1578
benchmark::internal::InitializeStreams
int InitializeStreams()
Definition: benchmark/src/benchmark.cc:595
benchmark::Shutdown
void Shutdown()
Definition: benchmark/src/benchmark.cc:607
benchmark::ConsoleReporter
Definition: benchmark/include/benchmark/benchmark.h:1571
g
struct @717 g
benchmark::Counter
Definition: benchmark/include/benchmark/benchmark.h:382
benchmark::ReportUnrecognizedArguments
bool ReportUnrecognizedArguments(int argc, char **argv)
Definition: benchmark/src/benchmark.cc:611
benchmark::IsColorTerminal
bool IsColorTerminal()
Definition: benchmark/src/colorprint.cc:158
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
benchmark::State::perf_counters_measurement_
internal::PerfCountersMeasurement *const perf_counters_measurement_
Definition: benchmark/include/benchmark/benchmark.h:735
benchmark::internal::ThreadManager::StartStopBarrier
bool StartStopBarrier() EXCLUDES(end_cond_mutex_)
Definition: third_party/benchmark/src/thread_manager.h:21
benchmark::Counter::kAvgIterations
@ kAvgIterations
Definition: benchmark/include/benchmark/benchmark.h:403
benchmark::BM_DEFINE_double
BM_DEFINE_double(benchmark_min_time, 0.5)
benchmark::State::finished_
bool finished_
Definition: benchmark/include/benchmark/benchmark.h:706
value
const char * value
Definition: hpack_parser_table.cc:165
benchmark::internal::PerfCountersMeasurement::Start
BENCHMARK_ALWAYS_INLINE void Start()
Definition: perf_counters.h:134
internal_macros.h
thread_manager.h
string_util.h
benchmark::BenchmarkReporter::SetOutputStream
void SetOutputStream(std::ostream *out)
Definition: benchmark/include/benchmark/benchmark.h:1541
benchmark::State::FinishKeepRunning
void FinishKeepRunning()
Definition: benchmark/src/benchmark.cc:237
benchmark::internal::memory_manager
MemoryManager * memory_manager
Definition: benchmark_runner.cc:60
BM_CHECK_EQ
#define BM_CHECK_EQ(a, b)
Definition: benchmark/src/check.h:68
key
const char * key
Definition: hpack_parser_table.cc:164
benchmark::BenchmarkReporter
Definition: benchmark/include/benchmark/benchmark.h:1412
benchmark::State
Definition: benchmark/include/benchmark/benchmark.h:503
benchmark::State::ResumeTiming
void ResumeTiming()
Definition: benchmark/src/benchmark.cc:198
commandlineflags.h
benchmark::State::PauseTiming
void PauseTiming()
Definition: benchmark/src/benchmark.cc:183
benchmark::State::error_occurred_
bool error_occurred_
Definition: benchmark/include/benchmark/benchmark.h:707
benchmark::internal::ThreadManager
Definition: third_party/benchmark/src/thread_manager.h:12
re.h
benchmark::BM_DEFINE_int32
BM_DEFINE_int32(benchmark_repetitions, 1)
benchmark::internal::PerfCountersMeasurement::StopAndGetMeasurements
BENCHMARK_ALWAYS_INLINE std::vector< std::pair< std::string, double > > StopAndGetMeasurements()
Definition: perf_counters.h:144
benchmark::MutexLock
Definition: benchmark/src/mutex.h:87
benchmark::ParseBoolFlag
bool ParseBoolFlag(const char *str, const char *flag, bool *value)
Definition: benchmark/src/commandlineflags.cc:204
benchmark::State::State
State(IterationCount max_iters, const std::vector< int64_t > &ranges, int thread_i, int n_threads, internal::ThreadTimer *timer, internal::ThreadManager *manager, internal::PerfCountersMeasurement *perf_counters_measurement)
Definition: benchmark/src/benchmark.cc:136
benchmark::ConsoleReporter::OO_Color
@ OO_Color
Definition: benchmark/include/benchmark/benchmark.h:1575
benchmark::internal::PrintUsageAndExit
void PrintUsageAndExit()
Definition: benchmark/src/benchmark.cc:519
benchmark::internal::global_context
std::map< std::string, std::string > * global_context
Definition: benchmark/src/benchmark.cc:129
benchmark::ParseKeyValueFlag
bool ParseKeyValueFlag(const char *str, const char *flag, std::map< std::string, std::string > *value)
Definition: benchmark/src/commandlineflags.cc:251
benchmark::State::thread_index_
const int thread_index_
Definition: benchmark/include/benchmark/benchmark.h:730
internal
Definition: benchmark/test/output_test_helper.cc:20
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
benchmark::BM_DEFINE_bool
BM_DEFINE_bool(benchmark_list_tests, false)
benchmark::IsFlag
bool IsFlag(const char *str, const char *flag)
Definition: benchmark/src/commandlineflags.cc:267
benchmark::internal::ParseCommandLineFlags
void ParseCommandLineFlags(int *argc, char **argv)
Definition: benchmark/src/benchmark.cc:540
benchmark::State::SetIterationTime
void SetIterationTime(double seconds)
Definition: benchmark/src/benchmark.cc:220
benchmark::ParseInt32Flag
bool ParseInt32Flag(const char *str, const char *flag, int32_t *value)
Definition: benchmark/src/commandlineflags.cc:216
complexity.h
benchmark::BenchmarkReporter::GetOutputStream
std::ostream & GetOutputStream() const
Definition: benchmark/include/benchmark/benchmark.h:1553
benchmark::internal::FindBenchmarksInternal
bool FindBenchmarksInternal(const std::string &re, std::vector< BenchmarkInstance > *benchmarks, std::ostream *Err)
Definition: benchmark/src/benchmark_register.cc:192
benchmark::ConsoleReporter::OO_None
@ OO_None
Definition: benchmark/include/benchmark/benchmark.h:1574
benchmark::AddCustomContext
void AddCustomContext(const std::string &key, const std::string &value)
Definition: benchmark/src/benchmark.cc:507
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
benchmark::BM_DEFINE_kvpairs
BM_DEFINE_kvpairs(benchmark_context, {})
benchmark::internal::UseCharPointer
void UseCharPointer(char const volatile *)
Definition: benchmark/src/benchmark.cc:132
timer
static uv_timer_t timer
Definition: test-callback-stack.c:34


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:46