diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2007-08-11 18:51:04 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2007-08-11 18:51:04 +0000 |
commit | 88447e9873d1a5b58c4d699f10abc2614f517a75 (patch) | |
tree | 2290800aa4d91f54abcfd241756df7c1896d4a8e /bin | |
parent | 9d4b5affc531cbb85ff4fb8626901d67902a2a31 (diff) | |
download | bitbake-88447e9873d1a5b58c4d699f10abc2614f517a75.tar.gz |
bitbake: Add profiling option -P
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bitbake | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/bitbake b/bin/bitbake index e7735fe5e..204b89fdf 100755 --- a/bin/bitbake +++ b/bin/bitbake @@ -102,6 +102,8 @@ Default BBFILES are the .bb files in the current directory.""" ) parser.add_option( "-l", "--log-domains", help = """Show debug logging for the specified logging domains""", action = "append", dest = "debug_domains", default = [] ) + parser.add_option( "-P", "--profile", help = "profile the command and print a report", + action = "store_true", dest = "profile", default = False ) options, args = parser.parse_args(sys.argv) @@ -110,8 +112,23 @@ Default BBFILES are the .bb files in the current directory.""" ) configuration.pkgs_to_build.extend(args[1:]) cooker = bb.cooker.BBCooker(configuration) - cooker.cook() + if configuration.profile: + try: + import cProfile as profile + except: + import profile + + profile.runctx("cooker.cook()", globals(), locals(), "profile.log") + import pstats + p = pstats.Stats('profile.log') + p.sort_stats('time') + p.print_stats() + p.print_callers() + p.sort_stats('cumulative') + p.print_stats() + else: + cooker.cook() if __name__ == "__main__": print """WARNING, WARNING, WARNING |