Register benchmarking flags. Args: benchmark_log_dir: Create a flag to specify location for benchmark logging. bigquery_uploader: Create flags for uploading results to BigQuery. Returns: A list of flags for core.py to marks as key flags.
(benchmark_log_dir=True, bigquery_uploader=True)
| 29 | |
| 30 | |
| 31 | def define_benchmark(benchmark_log_dir=True, bigquery_uploader=True): |
| 32 | """Register benchmarking flags. |
| 33 | |
| 34 | Args: |
| 35 | benchmark_log_dir: Create a flag to specify location for benchmark logging. |
| 36 | bigquery_uploader: Create flags for uploading results to BigQuery. |
| 37 | |
| 38 | Returns: |
| 39 | A list of flags for core.py to marks as key flags. |
| 40 | """ |
| 41 | |
| 42 | key_flags = [] |
| 43 | |
| 44 | flags.DEFINE_enum( |
| 45 | name="benchmark_logger_type", |
| 46 | default="BaseBenchmarkLogger", |
| 47 | enum_values=["BaseBenchmarkLogger", "BenchmarkFileLogger"], |
| 48 | help=help_wrap("The type of benchmark logger to use. Defaults to using " |
| 49 | "BaseBenchmarkLogger which logs to STDOUT. Different " |
| 50 | "loggers will require other flags to be able to work.")) |
| 51 | flags.DEFINE_string( |
| 52 | name="benchmark_test_id", |
| 53 | short_name="bti", |
| 54 | default=None, |
| 55 | help=help_wrap("The unique test ID of the benchmark run. It could be the " |
| 56 | "combination of key parameters. It is hardware " |
| 57 | "independent and could be used compare the performance " |
| 58 | "between different test runs. This flag is designed for " |
| 59 | "human consumption, and does not have any impact within " |
| 60 | "the system.")) |
| 61 | |
| 62 | define_log_steps() |
| 63 | |
| 64 | if benchmark_log_dir: |
| 65 | flags.DEFINE_string( |
| 66 | name="benchmark_log_dir", |
| 67 | short_name="bld", |
| 68 | default=None, |
| 69 | help=help_wrap("The location of the benchmark logging.")) |
| 70 | |
| 71 | if bigquery_uploader: |
| 72 | flags.DEFINE_string( |
| 73 | name="gcp_project", |
| 74 | short_name="gp", |
| 75 | default=None, |
| 76 | help=help_wrap( |
| 77 | "The GCP project name where the benchmark will be uploaded.")) |
| 78 | |
| 79 | flags.DEFINE_string( |
| 80 | name="bigquery_data_set", |
| 81 | short_name="bds", |
| 82 | default="test_benchmark", |
| 83 | help=help_wrap( |
| 84 | "The Bigquery dataset name where the benchmark will be uploaded.")) |
| 85 | |
| 86 | flags.DEFINE_string( |
| 87 | name="bigquery_run_table", |
| 88 | short_name="brt", |
nothing calls this directly
no test coverage detected