Skip to content

Instantly share code, notes, and snippets.

@g2384
Created June 26, 2015 13:10
Show Gist options
  • Save g2384/3359cf727ad284d3b6e5 to your computer and use it in GitHub Desktop.
Save g2384/3359cf727ad284d3b6e5 to your computer and use it in GitHub Desktop.
python timeit and subprocess
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