diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-10 16:22:54 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-28 14:49:05 +0000 |
| commit | cfb082961a6c9ac3d65738031c4071210529cd07 (patch) | |
| tree | c0f821e0927d61bdf4321906a2317dbfa8e04392 /bitbake/lib/bb/build.py | |
| parent | dd335b09089c14016642a51b812500556e8f453c (diff) | |
| download | poky-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/lib/bb/build.py')
| -rw-r--r-- | bitbake/lib/bb/build.py | 18 |
1 files changed, 16 insertions, 2 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 | ||
| 426 | def exec_task(fn, task, d): | 426 | def 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: |
