I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script. Any leads would be helpful thanks in advance.
2 Answers
You can use the time command to get the runtime of the python script.
]$ cat time_test.bash
#!/bin/bash
# You can use: time python script.py
time python -c 'import os;os.getenv("HOME")'
Output will be something like this
]$ ./time_test.bash
real 0m0.010s
user 0m0.005s
sys 0m0.005s
1 Comment
MrAdfire
I will try this code just wondering.is there way i can store execution time value in a variable?
Call the python script with /usr/bin/time script. This allows you to track CPU and wall-clock time of the script.