python - Average time and CPU Linux -


i need cpu usage , execution time of program in python. have make average of 30 executions , must use time command (linux). i've never worked linux before i'm struggling make work. i've tried number of ways , that's did far.

#!/bin/bash  size=400 n_cpu=4  /usr/bin/time -f "cpu:  %p    time:  %e" in {1..30};     python "script.py" $size $size $n_cpu done  

could tell me should do?

#!/bin/bash -x  size=400 n_cpu=4 trials=($(seq 1 30))  trial in "${trials[@]}"     { time -p python "script.py" $size $size $n_cpu; } 2> $trial.time done   # optional aggregation , cleanup cat *.time > trials.txt && rm -rf *.time 

after that, pull trials.txt r or python script calculate runtime statistics (mean, std. deviation, etc.).


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -