[pypy-commit] pypy default: Back out changeset 89c0969caec9.
Manuel Jacob
noreply at buildbot.pypy.org
Tue Jan 21 14:44:52 CET 2014
Author: Manuel Jacob
Branch:
Changeset: r68809:3f632ce16792
Date: 2014-01-21 14:44 +0100
http://bitbucket.org/pypy/pypy/changeset/3f632ce16792/
Log: Back out changeset 89c0969caec9.
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -33,6 +33,9 @@
# TODO:
# sanity-checks using states
+# set of translation steps to profile
+PROFILE = set([])
+
class Instrument(Exception):
pass
@@ -245,6 +248,15 @@
def info(self, msg):
log.info(msg)
+ def _profile(self, goal, func):
+ from cProfile import Profile
+ from rpython.tool.lsprofcalltree import KCacheGrind
+ d = {'func':func}
+ prof = Profile()
+ prof.runctx("res = func()", globals(), d)
+ KCacheGrind(prof).output(open(goal + ".out", "w"))
+ return d['res']
+
def _do(self, goal, func, *args, **kwds):
title = func.task_title
if goal in self.done:
@@ -258,7 +270,10 @@
try:
instrument = False
try:
- res = func()
+ if goal in PROFILE:
+ res = self._profile(goal, func)
+ else:
+ res = func()
except Instrument:
instrument = True
if not func.task_idempotent:
More information about the pypy-commit
mailing list