/usr/share/sumo/tools/output/timingStats.py is in sumo-tools 0.15.0~dfsg-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/usr/bin/env python
"""
@file timingStats.py
@author Michael Behrisch
@author Daniel Krajzewicz
@date 2010-10-15
@version $Id: timingStats.py 11671 2012-01-07 20:14:30Z behrisch $
This script executes a config repeatedly and measures the execution time,
computes the mean values and deviation.
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2008-2012 DLR (http://www.dlr.de/) and contributors
All rights reserved
"""
import os, sys, subprocess, numpy
from optparse import OptionParser
from datetime import datetime
# initialise
optParser = OptionParser()
optParser.add_option("-v", "--verbose", action="store_true",
default=False, help="tell me what you are doing")
optParser.add_option("-c", "--configuration",
help="sumo configuration to run", metavar="FILE")
optParser.add_option("-r", "--repeat", type="int", default="20",
help="how many times to run")
# parse options
(options, args) = optParser.parse_args()
sumoBinary = os.environ.get("NETCONVERT_BINARY", os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'bin', 'sumo'))
elapsed = []
for run in range(options.repeat):
before = datetime.now()
subprocess.call([sumoBinary, '-c', options.configuration])
td = datetime.now() - before
elapsed.append(td.microseconds + 1000000 * td.seconds)
a = numpy.array(elapsed)
print "%.4f %.4f" % (a.mean() / 1000, a.std() / 1000)
|