Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added an argument to select a benchmark dir.

This means you could now use the harness to benchmark other things, so I
suppose this is now a general purpose Django benchmarking library. Thanks
to Eric Holscher for the idea.
  • Loading branch information...
commit 432e49622180505e19648dc9b0ef825483238426 1 parent ed837b6
Jacob Kaplan-Moss jacobian authored
Showing with 18 additions and 3 deletions.
  1. +18 −3 djangobench/main.py
21 djangobench/main.py
View
@@ -9,9 +9,9 @@
from unipath import DIRS, FSPath as Path
from djangobench import perf
-BENCMARK_DIR = Path(__file__).parent.child('benchmarks').absolute()
+DEFAULT_BENCMARK_DIR = Path(__file__).parent.child('benchmarks').absolute()
-def run_benchmarks(control, experiment, benchmarks, trials, dump_times=False, benchmark_dir=BENCMARK_DIR):
+def run_benchmarks(control, experiment, benchmark_dir, benchmarks, trials, dump_times):
if benchmarks:
print "Running benchmarks: %s" % " ".join(benchmarks)
else:
@@ -191,14 +191,29 @@ def main():
help = 'Dump raw times to stdout. Careful - prints a *lot* of data!',
)
parser.add_argument(
+ '--benchmark-dir',
+ dest = 'benchmark_dir',
+ default = DEFAULT_BENCMARK_DIR,
+ help = ('Directory to inspect for benchmarks. Defaults to the '
+ 'benchmarks included with djangobench.'),
+ )
+ parser.add_argument(
'benchmarks',
metavar = 'name',
default = None,
help = "Benchmarks to be run. Defaults to all.",
nargs = '*'
)
+
args = parser.parse_args()
- run_benchmarks(args.control, args.experiment, args.benchmarks, args.trials, args.dump_times)
+ run_benchmarks(
+ control = args.control,
+ experiment = args.experiment,
+ benchmark_dir = args.benchmark_dir,
+ benchmarks = args.benchmarks,
+ trials = args.trials,
+ dump_times = args.dump_times
+ )
if __name__ == '__main__':
main()
Please sign in to comment.
Something went wrong with that request. Please try again.