summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-10 16:22:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-28 14:49:05 +0000
commitcfb082961a6c9ac3d65738031c4071210529cd07 (patch)
treec0f821e0927d61bdf4321906a2317dbfa8e04392 /bitbake
parentdd335b09089c14016642a51b812500556e8f453c (diff)
downloadpoky-cfb082961a6c9ac3d65738031c4071210529cd07.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py18
-rw-r--r--bitbake/lib/bb/runqueue.py3
2 files changed, 18 insertions, 3 deletions
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):
423 423
424 return 0 424 return 0
425 425
426def exec_task(fn, task, d): 426def exec_task(fn, task, d, profile = False):
427 try: 427 try:
428 quieterr = False 428 quieterr = False
429 if d.getVarFlag(task, "quieterrors") is not None: 429 if d.getVarFlag(task, "quieterrors") is not None:
430 quieterr = True 430 quieterr = True
431 431
432 return _exec_task(fn, task, d, quieterr) 432 if profile:
433 profname = "profile-%s.log" % (os.path.basename(fn) + "-" + task)
434 try:
435 import cProfile as profile
436 except:
437 import profile
438 prof = profile.Profile()
439 ret = profile.Profile.runcall(prof, _exec_task, fn, task, d, quieterr)
440 prof.dump_stats(profname)
441 bb.utils.process_profilelog(profname)
442
443 return ret
444 else:
445 return _exec_task(fn, task, d, quieterr)
446
433 except Exception: 447 except Exception:
434 from traceback import format_exc 448 from traceback import format_exc
435 if not quieterr: 449 if not quieterr:
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 0c7dfec2b6..1bbe7911cd 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1149,7 +1149,8 @@ class RunQueueExecute:
1149 os._exit(1) 1149 os._exit(1)
1150 try: 1150 try:
1151 if not self.cooker.configuration.dry_run: 1151 if not self.cooker.configuration.dry_run:
1152 ret = bb.build.exec_task(fn, taskname, the_data) 1152 profile = self.cooker.configuration.profile
1153 ret = bb.build.exec_task(fn, taskname, the_data, profile)
1153 os._exit(ret) 1154 os._exit(ret)
1154 except: 1155 except:
1155 os._exit(1) 1156 os._exit(1)