summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2007-08-11 18:51:04 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2007-08-11 18:51:04 +0000
commit37c8e3b3bbf7ac0c52714adc56727908ec4dc1cc (patch)
treefe2470087f51b92fce933ef45b3050d05154f7f9
parent76e1d03f79ab8d255632237f55f8a992f62bad56 (diff)
downloadbitbake-37c8e3b3bbf7ac0c52714adc56727908ec4dc1cc.tar.gz
bitbake: Add profiling option -P
-rw-r--r--ChangeLog1
-rwxr-xr-xbin/bitbake19
2 files changed, 19 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 107209d73..c5641836d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ Changes in Bitbake 1.8.x:
- Add pn-PN to overrides when evaluating PREFERRED_VERSION
- Improve the progress indicator by skipping tasks that have
already run before starting the build rather than during it
+ - Add profiling option (-P)
Changes in Bitbake 1.8.6:
- Correctly redirect stdin when forking
diff --git a/bin/bitbake b/bin/bitbake
index 4b212adc2..8b69a0a33 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__":
main()