Skip to content

Commit

Permalink
quality of life touchups for benchmark script
Browse files Browse the repository at this point in the history
  • Loading branch information
domanchi committed May 28, 2019
1 parent 36cdd55 commit 75dc36e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions scripts/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/python3
import argparse
import json
import os
import statistics
import subprocess
import sys

from monotonic import monotonic

Expand All @@ -12,6 +14,17 @@
def main():
args = get_arguments()

print(
'Running performance tests on: {}'.format(
', '.join(args.plugin),
),
file=sys.stderr,
)
print(
'for: {}'.format(args.filenames),
file=sys.stderr,
)

# First, convert chosen plugins into their disabled flags
always_disabled_plugins = []
flag_list = []
Expand Down Expand Up @@ -97,7 +110,14 @@ def get_arguments():

args = parser.parse_args()
if not args.filenames:
args.filenames = ['../.']
args.filenames = [
os.path.realpath(
os.path.join(
os.path.dirname(__file__),
'../',
),
),
]

if not args.plugin:
args.plugin = plugins
Expand Down Expand Up @@ -128,7 +148,7 @@ def time_execution(filenames, timeout, num_iterations=1, flags=None):
scores.append(monotonic() - start_time)
except subprocess.TimeoutExpired:
scores.append(timeout)

return statistics.mean(scores)


Expand Down

0 comments on commit 75dc36e

Please sign in to comment.