Rev 3517: (robertc) Add -Dmemory for quick memory gathering. (Robert Collins) in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Fri Jul 4 08:01:24 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 3517
revision-id: robertc at robertcollins.net-20080704070119-qskk0ewwpxpzlfkl
parent: robertc at robertcollins.net-20080704060510-9213mmskugmxfe4n
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Fri 2008-07-04 17:01:19 +1000
message:
  (robertc) Add -Dmemory for quick memory gathering. (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
=== modified file 'NEWS'
--- a/NEWS	2008-06-26 06:06:49 +0000
+++ b/NEWS	2008-07-04 07:01:19 +0000
@@ -63,6 +63,9 @@
 
   TESTING:
 
+   * ``-Dmemory`` will cause /proc/PID/status to be catted before bzr
+     exits, allowing low-key analysis of peak memory use. (Robert Collins)
+
    * ``TestCaseWithTransport.make_branch_and_tree`` tries harder to return
      a tree with a ``branch`` attribute of the right format.  This was
      preventing some ``RemoteBranch`` tests from actually running with

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2008-05-28 23:20:33 +0000
+++ b/bzrlib/commands.py	2008-07-04 07:01:19 +0000
@@ -795,6 +795,17 @@
             ret = apply_coveraged(opt_coverage_dir, run, *run_argv)
         else:
             ret = run(*run_argv)
+        if 'memory' in debug.debug_flags:
+            try:
+                status_file = file('/proc/%s/status' % os.getpid(), 'rb')
+            except IOError:
+                pass
+            else:
+                status = status_file.read()
+                status_file.close()
+                trace.note("Process status after command:")
+                for line in status.splitlines():
+                    trace.note(line)
         return ret or 0
     finally:
         # reset, in case we may do other commands later within the same process




More information about the bazaar-commits mailing list