From 08b77c8cef3d93098118b9141c19bba382b30d6f Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 27 May 2015 17:31:10 +0100 Subject: bitbake: 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. (Bitbake rev: d3d2541aacd1ea560da0d8b25a3ea3f0563dee70) Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 988b845a4a..857f5bcf96 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/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() -- cgit v1.2.3-54-g00ecf