Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit ec81201

Browse files
committed
really fix profiling this time I promise
1 parent 32f788c commit ec81201

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ethereum/tests/profile_vm.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
import ethereum.testutils as testutils
44
import cProfile
55
import pstats
6-
from io import BytesIO
76
import time
87
from rlp.utils import encode_hex
98
from ethereum.utils import sha3, to_string
109
from ethereum.slogging import get_logger
1110
logger = get_logger()
1211

1312

13+
if sys.version_info.major == 2:
14+
from io import BytesIO as StringIO
15+
else:
16+
from io import StringIO
17+
18+
1419
def do_test_vm(filename, testname=None, testdata=None, limit=99999999, profiler=None):
1520
logger.debug('running test:%r in %r' % (testname, filename))
1621
testutils.run_vm_test(testutils.fixture_to_bytes(testdata), testutils.VERIFY, profiler=profiler)
@@ -39,7 +44,7 @@ def run(profiler=None):
3944
if len(sys.argv) == 1:
4045
pr = cProfile.Profile()
4146
run(pr)
42-
s = BytesIO()
47+
s = StringIO()
4348
sortby = 'tottime'
4449
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
4550
ps.print_stats(50)

0 commit comments

Comments
 (0)