bitbake: build.py: Dump out performance data of individual tasks

(Bitbake rev: 32aa49519e4f015e3c21466a7e5dc939f6369851)

Signed-off-by: Richard  Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2011-06-10 16:22:54 +00:00
parent dd335b0908
commit cfb082961a
2 changed files with 18 additions and 3 deletions

View File

@ -423,13 +423,27 @@ def _exec_task(fn, task, d, quieterr):
return 0
def exec_task(fn, task, d):
def exec_task(fn, task, d, profile = False):
try:
quieterr = False
if d.getVarFlag(task, "quieterrors") is not None:
quieterr = True
return _exec_task(fn, task, d, quieterr)
if profile:
profname = "profile-%s.log" % (os.path.basename(fn) + "-" + task)
try:
import cProfile as profile
except:
import profile
prof = profile.Profile()
ret = profile.Profile.runcall(prof, _exec_task, fn, task, d, quieterr)
prof.dump_stats(profname)
bb.utils.process_profilelog(profname)
return ret
else:
return _exec_task(fn, task, d, quieterr)
except Exception:
from traceback import format_exc
if not quieterr:

View File

@ -1149,7 +1149,8 @@ class RunQueueExecute:
os._exit(1)
try:
if not self.cooker.configuration.dry_run:
ret = bb.build.exec_task(fn, taskname, the_data)
profile = self.cooker.configuration.profile
ret = bb.build.exec_task(fn, taskname, the_data, profile)
os._exit(ret)
except:
os._exit(1)