aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-27 17:31:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-29 10:14:41 +0100
commitd3d2541aacd1ea560da0d8b25a3ea3f0563dee70 (patch)
treea53d2c845cf7d4546dd1866f6979e99e1f107819 /lib/bb/utils.py
parented5a8954ac923eda9750a636c5bb5b95ffce664f (diff)
downloadbitbake-d3d2541aacd1ea560da0d8b25a3ea3f0563dee70.tar.gz
cooker/utils: Improve parsing profiling
Currently the cooker parsing processes each dump an individual profile which is ok, but means absolute numbers of function calls for a given load can be tricky to determine as parsing of recipes may go to different pool threads on different runs. This change collects up the individual thread parsing results and processes them into one profile output. The profile processing function in utils needed tweaks to allow this to work. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 988b845a4..857f5bcf9 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -908,11 +908,17 @@ def cpu_count():
def nonblockingfd(fd):
fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
-def process_profilelog(fn):
- pout = open(fn + '.processed', 'w')
+def process_profilelog(fn, pout = None):
+ # Either call with a list of filenames and set pout or a filename and optionally pout.
+ if not pout:
+ pout = fn + '.processed'
+ pout = open(pout, 'w')
import pstats
- p = pstats.Stats(fn, stream=pout)
+ if isinstance(fn, list):
+ p = pstats.Stats(*fn, stream=pout)
+ else:
+ p = pstats.Stats(fn, stream=pout)
p.sort_stats('time')
p.print_stats()
p.print_callers()