[Pkg-bazaar-commits] ./bzr/unstable r238: - Don't put profiling temp file in current directory

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:43:58 UTC 2009


------------------------------------------------------------
revno: 238
committer: mbp at sourcefrog.net
timestamp: Mon 2005-04-11 12:50:08 +1000
message:
  - Don't put profiling temp file in current directory
modified:
  NEWS
  bzrlib/commands.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-04-11 02:06:33 +0000
+++ b/NEWS	2005-04-11 02:50:08 +0000
@@ -18,6 +18,8 @@
 
     * More tests in test.sh.
 
+    * Write profile data to a temporary file not into working directory.
+
 
 bzr-0.0.3  2005-04-06
 

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-04-11 02:44:45 +0000
+++ b/bzrlib/commands.py	2005-04-11 02:50:08 +0000
@@ -986,14 +986,17 @@
 
     if profile:
         import hotshot
-        prof = hotshot.Profile('.bzr.profile')
+        pfname = tempfile.mkstemp()[1]
+        prof = hotshot.Profile(pfname)
         ret = prof.runcall(cmd_handler, **cmdargs) or 0
         prof.close()
 
         import hotshot.stats
-        stats = hotshot.stats.load('.bzr.profile')
+        stats = hotshot.stats.load(pfname)
         #stats.strip_dirs()
         stats.sort_stats('time')
+        ## XXX: Might like to write to stderr or the trace file instead but
+        ## print_stats seems hardcoded to stdout
         stats.print_stats(20)
 
         return ret



More information about the Pkg-bazaar-commits mailing list