Skip to content

Commit

Permalink
fix profile_vm.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
pipermerriam committed Jun 20, 2016
1 parent 4bdce81 commit be9b73a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ethereum/tests/profile_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import ethereum.testutils as testutils
import cProfile
import pstats
import StringIO
import time
from rlp.utils import encode_hex
from ethereum.utils import sha3
from ethereum.utils import sha3, to_string
from ethereum.slogging import get_logger
logger = get_logger()


if sys.version_info.major == 2:
from io import BytesIO as StringIO
else:
from io import StringIO


def do_test_vm(filename, testname=None, testdata=None, limit=99999999, profiler=None):
logger.debug('running test:%r in %r' % (testname, filename))
testutils.run_vm_test(testutils.fixture_to_bytes(testdata), testutils.VERIFY, profiler=profiler)
Expand All @@ -31,15 +36,15 @@ def run(profiler=None):
if i == num:
break
do_test_vm(filename, testname, testdata, profiler=profiler)
seen += str(testname)
seen += to_string(testname)
i += 1
print('ran %d tests' % i)
print('test key', encode_hex(sha3(seen)))

if len(sys.argv) == 1:
pr = cProfile.Profile()
run(pr)
s = StringIO.StringIO()
s = StringIO()
sortby = 'tottime'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats(50)
Expand Down

0 comments on commit be9b73a

Please sign in to comment.