| 128 | |
| 129 | |
| 130 | def build_parser(): |
| 131 | parser = argparse.ArgumentParser( |
| 132 | description="Benchmark and compare contractor binaries" |
| 133 | ) |
| 134 | subparsers = parser.add_subparsers(help="subcommand help") |
| 135 | |
| 136 | parser_run = subparsers.add_parser("run", help="run the benchmark") |
| 137 | parser_run.set_defaults(func=run) |
| 138 | parser_run.add_argument( |
| 139 | "--runs", |
| 140 | help="How many times to run the comparison", |
| 141 | type=int, |
| 142 | default=10, |
| 143 | metavar="NUM", |
| 144 | ) |
| 145 | parser_run.add_argument( |
| 146 | "--keep", |
| 147 | help="Keep the generated datasets", |
| 148 | action="store_true", |
| 149 | ) |
| 150 | parser_run.add_argument("--dataset", help="path/to/dataset.osrm", metavar="PATH") |
| 151 | parser_run.add_argument( |
| 152 | "--logfiles", |
| 153 | nargs="+", |
| 154 | help="where to write the test logs", |
| 155 | metavar="PATH", |
| 156 | ) |
| 157 | parser_run.add_argument( |
| 158 | "--binaries", |
| 159 | nargs="+", |
| 160 | help="The contractor binaries to compare", |
| 161 | metavar="CONTRACTOR", |
| 162 | ) |
| 163 | |
| 164 | parser_report = subparsers.add_parser( |
| 165 | "report", help="analyze the benchmark logfile" |
| 166 | ) |
| 167 | parser_report.set_defaults(func=report) |
| 168 | parser_report.add_argument( |
| 169 | "--logfiles", |
| 170 | nargs="+", |
| 171 | help="the log file to process", |
| 172 | metavar="PATH", |
| 173 | ) |
| 174 | parser_report.add_argument( |
| 175 | "--runs", |
| 176 | help="How many runs to read from the logs", |
| 177 | type=int, |
| 178 | default=0, |
| 179 | metavar="NUM", |
| 180 | ) |
| 181 | |
| 182 | parser_copy = subparsers.add_parser( |
| 183 | "copy", help="make a copy of the source dataset" |
| 184 | ) |
| 185 | parser_copy.set_defaults(func=copy) |
| 186 | parser_copy.add_argument("--dataset", help="path/to/dataset.osrm", metavar="PATH") |
| 187 | |