Skip to content

Commit

Permalink
fixing windows path and optionally saving fig directly to disk #9278
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Feb 22, 2024
1 parent 923e2a8 commit 39d6544
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/devel/scalability.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def get_options(args=None):
help="run all thread counts, not only the powers of 2")
argparser.add_argument("-v", "--verbose", action="store_true", default=False,
help="give more information")
argparser.add_argument("--number", type=int, default=100, help="number of vehicles")
argparser.add_argument("-n", "--number", type=int, default=100, help="number of vehicles")
argparser.add_argument("--figure", metavar="FILE", help="save figure to FILE")
return argparser.parse_args(args)


Expand Down Expand Up @@ -73,13 +74,16 @@ def main():
results = []
for t in tc:
timer = timeit.Timer('subprocess.call(["%s", "-n", "net.net.xml", "-r", "%s", "--threads", "%s", "--no-step-log"])' %
(sumolib.checkBinary("sumo"), rout.name, t), setup='import subprocess')
(sumolib.checkBinary("sumo").replace("\\", "\\\\"), rout.name, t), setup='import subprocess')
times = timer.repeat(options.runs, 1)
if options.verbose:
print(t, times)
results.append((t, min(times)))
plt.plot(*zip(*results))
plt.show()
if options.figure:
plt.savefig(options.figure)
else:
plt.show()


if __name__ == "__main__":
Expand Down

0 comments on commit 39d6544

Please sign in to comment.