Added test harness
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12452 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6bfc86dee7
commit
1e094f865e
22 changed files with 66 additions and 226 deletions
30
Examples/python/performance/harness.py
Normal file
30
Examples/python/performance/harness.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env
|
||||
|
||||
import sys
|
||||
import time
|
||||
import imp
|
||||
from subprocess import *
|
||||
|
||||
def run (proc) :
|
||||
|
||||
try :
|
||||
mod = imp.find_module(sys.argv[1])
|
||||
mod = imp.load_module(sys.argv[1], *mod)
|
||||
|
||||
t1 = time.clock()
|
||||
proc(mod)
|
||||
t2 = time.clock()
|
||||
print "%s took %f seconds" % (mod.__name__, t2 - t1)
|
||||
|
||||
except IndexError :
|
||||
proc = Popen([sys.executable, 'runme.py', 'Simple_baseline'], stdout=PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
print stdout
|
||||
|
||||
proc = Popen([sys.executable, 'runme.py', 'Simple_optimized'], stdout=PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
print stdout
|
||||
|
||||
proc = Popen([sys.executable, 'runme.py', 'Simple_builtin'], stdout=PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
print stdout
|
||||
Loading…
Add table
Add a link
Reference in a new issue