From 25442536cc7291582d235c5c2fd84a90933b06aa Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Thu, 8 Jun 2023 15:56:24 +0100 Subject: [PATCH] Expose --min-time from pyperf to pyperformance CLI The user can now control the minimum time a benchmark should run directly from the CLI via --min-time which then is passed to pyperf. --- pyperformance/cli.py | 3 +++ pyperformance/run.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/pyperformance/cli.py b/pyperformance/cli.py index 330d6e57..34544a11 100644 --- a/pyperformance/cli.py +++ b/pyperformance/cli.py @@ -72,6 +72,9 @@ def parse_args(): cmd.add_argument("--append", metavar="FILENAME", help="Add runs to an existing file, or create it " "if it doesn't exist") + cmd.add_argument("--min-time", metavar="MIN_TIME", + help="Minimum duration in seconds of a single " + "value, used to calibrate the number of loops") filter_opts(cmd) # show diff --git a/pyperformance/run.py b/pyperformance/run.py index 65e1a9e9..aa2b3744 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -206,5 +206,7 @@ def get_pyperf_opts(options): opts.append('--track-memory') if options.inherit_environ: opts.append('--inherit-environ=%s' % ','.join(options.inherit_environ)) + if options.min_time: + opts.append('--min-time=%s' % options.min_time) return opts