diff --git a/pyperformance/cli.py b/pyperformance/cli.py index df68dc3d..d8822726 100644 --- a/pyperformance/cli.py +++ b/pyperformance/cli.py @@ -101,6 +101,8 @@ def parse_args(): choices=hook_names, metavar=f"{', '.join(x for x in hook_names if not x.startswith('_'))}", help="Apply the given pyperf hook(s) when running each benchmark") + cmd.add_argument("--warmups", type=int, default=None, + help="number of skipped values per run used to warmup the benchmark") filter_opts(cmd) # show diff --git a/pyperformance/run.py b/pyperformance/run.py index a9f9a102..b535f96a 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -247,5 +247,8 @@ def get_pyperf_opts(options): if options.hook: for hook in options.hook: opts.append('--hook=%s' % hook) + # --warmups=0 is a valid option, so check for `not None` here + if options.warmups is not None: + opts.append('--warmups=%s' % options.warmups) return opts