Created
June 26, 2015 13:10
-
-
Save g2384/3359cf727ad284d3b6e5 to your computer and use it in GitHub Desktop.
python timeit and subprocess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
from timeit import Timer | |
args = ("./a.out") | |
output = False | |
def timing(): | |
popen = subprocess.Popen(args, stdout=subprocess.PIPE) | |
popen.wait() | |
return | |
if output: | |
print(popen.stdout.read()) | |
t=Timer(timing) | |
print(t.timeit(1000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment