From cfb082961a6c9ac3d65738031c4071210529cd07 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 10 Jun 2011 16:22:54 +0000 Subject: bitbake: build.py: Dump out performance data of individual tasks (Bitbake rev: 32aa49519e4f015e3c21466a7e5dc939f6369851) Signed-off-by: Richard Purdie Signed-off-by: Richard Purdie --- bitbake/lib/bb/build.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/build.py') diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 2f6a61f4b0..5f5a007196 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -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: -- cgit v1.2.3-54-g00ecf