summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-27 14:56:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-28 15:12:45 +0100
commitac66e15f5cf0dfabab84967338909632559f5b7b (patch)
treec1c7da7a46f34d62165b7f129b6447aa3537d9f5 /bitbake
parentc79b7f06af33f0b4531455aab25b6af646d29284 (diff)
downloadpoky-ac66e15f5cf0dfabab84967338909632559f5b7b.tar.gz
bitbake: utils: Improve profile log processing
This stream redirection of stdout is horrible. pstats takes a stream argument so lets use that instead. (Bitbake rev: 93d155f4766e27e7b004d13569aa03961fe89e3b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/utils.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 7d37a745a4..670e592fe0 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -862,21 +862,16 @@ def nonblockingfd(fd):
862 fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) 862 fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
863 863
864def process_profilelog(fn): 864def process_profilelog(fn):
865 # Redirect stdout to capture profile information
866 pout = open(fn + '.processed', 'w') 865 pout = open(fn + '.processed', 'w')
867 so = sys.stdout.fileno()
868 orig_so = os.dup(sys.stdout.fileno())
869 os.dup2(pout.fileno(), so)
870 866
871 import pstats 867 import pstats
872 p = pstats.Stats(fn) 868 p = pstats.Stats(fn, stream=pout)
873 p.sort_stats('time') 869 p.sort_stats('time')
874 p.print_stats() 870 p.print_stats()
875 p.print_callers() 871 p.print_callers()
876 p.sort_stats('cumulative') 872 p.sort_stats('cumulative')
877 p.print_stats() 873 p.print_stats()
878 874
879 os.dup2(orig_so, so)
880 pout.flush() 875 pout.flush()
881 pout.close() 876 pout.close()
882 877