I have a wrapper script wrapper.py
that would time the full execution of benchrun.py
.
Let’s say I run the benchrun.py
using this command:
python benchrun.py --host {host} -f {testfile} -t {number of threads} -s {mongo shell path}
What should I put in the wrapper script to run the benchrun.py
script and get the execution time?
Advertisement
Answer
First, benchrun.py
JavaScript
x
6
1
import datetime
2
3
print ("sleeping now...")
4
time.sleep(10)
5
print ("done!")
6
wrapper:
JavaScript
1
9
1
import os
2
from datetime import datetime, timedelta
3
4
before = datetime.now()
5
os.system("python benchrun.py")
6
after = datetime.now()
7
8
print ("execution time: {0}".format(after - before))
9