Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move flags inside the benchmark namespace #1185

Merged
merged 2 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "thread_manager.h"
#include "thread_timer.h"

namespace benchmark {
// Print a list of benchmarks. This option overrides all other options.
DEFINE_bool(benchmark_list_tests, false);

Expand Down Expand Up @@ -112,20 +113,19 @@ DEFINE_string(benchmark_color, "auto");
// Valid values: 'true'/'yes'/1, 'false'/'no'/0. Defaults to false.
DEFINE_bool(benchmark_counters_tabular, false);

// The level of verbose logging to output
DEFINE_int32(v, 0);

// List of additional perf counters to collect, in libpfm format. For more
// information about libpfm: https://man7.org/linux/man-pages/man3/libpfm.3.html
DEFINE_string(benchmark_perf_counters, "");

namespace benchmark {
namespace internal {

// Extra context to include in the output formatted as comma-separated key-value
// pairs. Kept internal as it's only used for parsing from env/command line.
DEFINE_kvpairs(benchmark_context, {});

// The level of verbose logging to output
DEFINE_int32(v, 0);

namespace internal {

std::map<std::string, std::string>* global_context = nullptr;

// FIXME: wouldn't LTO mess this up?
Expand Down Expand Up @@ -530,6 +530,7 @@ void PrintUsageAndExit() {
" [--benchmark_out_format=<json|console|csv>]\n"
" [--benchmark_color={auto|true|false}]\n"
" [--benchmark_counters_tabular={true|false}]\n"
" [--benchmark_perf_counters=<counter>,...]\n"
" [--benchmark_context=<key>=<value>,...]\n"
" [--v=<verbosity>]\n");
exit(0);
Expand Down
8 changes: 2 additions & 6 deletions src/benchmark_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@
#include "perf_counters.h"
#include "thread_manager.h"

DECLARE_double(benchmark_min_time);
namespace benchmark {

DECLARE_double(benchmark_min_time);
DECLARE_int32(benchmark_repetitions);

DECLARE_bool(benchmark_report_aggregates_only);

DECLARE_bool(benchmark_display_aggregates_only);

DECLARE_string(benchmark_perf_counters);

namespace benchmark {

namespace internal {

extern MemoryManager* memory_manager;
Expand Down
3 changes: 2 additions & 1 deletion test/benchmark_random_interleaving_gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace benchmark {

DECLARE_bool(benchmark_enable_random_interleaving);
DECLARE_string(benchmark_filter);
DECLARE_int32(benchmark_repetitions);

namespace benchmark {
namespace internal {
namespace {

Expand Down