mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
bitbake: utils: Split profile reports into separate files
Use a more logical name for the profile reports and put each report into a separate file since people struggle to discover them currently. (Bitbake rev: a8145c84e0899285a5e6a809f1515118b002b106) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -2241,9 +2241,9 @@ class CookerParser(object):
|
|||||||
profiles.append(logfile)
|
profiles.append(logfile)
|
||||||
|
|
||||||
if profiles:
|
if profiles:
|
||||||
pout = "profile-parse.log.processed"
|
fn_out = "profile-parse.log.report"
|
||||||
bb.utils.process_profilelog(profiles, pout = pout)
|
bb.utils.process_profilelog(profiles, fn_out=fn_out)
|
||||||
print("Processed parsing statistics saved to %s" % (pout))
|
print("Processed parsing statistics saved to %s" % (fn_out))
|
||||||
|
|
||||||
def final_cleanup(self):
|
def final_cleanup(self):
|
||||||
if self.syncthread:
|
if self.syncthread:
|
||||||
|
|||||||
@@ -1441,29 +1441,43 @@ def profile_function(profile, function, output_fn, process=True):
|
|||||||
prof.dump_stats(output_fn)
|
prof.dump_stats(output_fn)
|
||||||
if process:
|
if process:
|
||||||
process_profilelog(output_fn)
|
process_profilelog(output_fn)
|
||||||
serverlog("Raw profiling information saved to %s and processed statistics to %s.processed" % (output_fn, output_fn))
|
serverlog("Raw profiling information saved to %s and processed statistics to %s.report*" % (output_fn, output_fn))
|
||||||
return ret
|
return ret
|
||||||
else:
|
else:
|
||||||
return function()
|
return function()
|
||||||
|
|
||||||
def process_profilelog(fn, pout = None):
|
def process_profilelog(fn, fn_out = None):
|
||||||
# Either call with a list of filenames and set pout or a filename and optionally pout.
|
# Either call with a list of filenames and set pout or a filename and optionally pout.
|
||||||
if not pout:
|
import pstats
|
||||||
pout = fn + '.processed'
|
|
||||||
|
|
||||||
with open(pout, 'w') as pout:
|
if not fn_out:
|
||||||
import pstats
|
fn_out = fn + '.report'
|
||||||
|
|
||||||
|
def pstatopen():
|
||||||
if isinstance(fn, list):
|
if isinstance(fn, list):
|
||||||
p = pstats.Stats(*fn, stream=pout)
|
return pstats.Stats(*fn, stream=pout)
|
||||||
else:
|
return pstats.Stats(fn, stream=pout)
|
||||||
p = pstats.Stats(fn, stream=pout)
|
|
||||||
|
with open(fn_out + '.time', 'w') as pout:
|
||||||
|
p = pstatopen()
|
||||||
p.sort_stats('time')
|
p.sort_stats('time')
|
||||||
p.print_stats()
|
p.print_stats()
|
||||||
|
|
||||||
|
with open(fn_out + '.time-callers', 'w') as pout:
|
||||||
|
p = pstatopen()
|
||||||
|
p.sort_stats('time')
|
||||||
p.print_callers()
|
p.print_callers()
|
||||||
|
|
||||||
|
with open(fn_out + '.cumulative', 'w') as pout:
|
||||||
|
p = pstatopen()
|
||||||
p.sort_stats('cumulative')
|
p.sort_stats('cumulative')
|
||||||
p.print_stats()
|
p.print_stats()
|
||||||
|
|
||||||
pout.flush()
|
with open(fn_out + '.cumulative-callers', 'w') as pout:
|
||||||
|
p = pstatopen()
|
||||||
|
p.sort_stats('cumulative')
|
||||||
|
p.print_callers()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Was present to work around multiprocessing pool bugs in python < 2.7.3
|
# Was present to work around multiprocessing pool bugs in python < 2.7.3
|
||||||
|
|||||||
Reference in New Issue
Block a user