Rev 3525: (robertc) Add -Dmemory for quick memory gathering. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jul 4 08:21:39 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3525
revision-id:pqm at pqm.ubuntu.com-20080704072129-0tmx82996zdrysst
parent: pqm at pqm.ubuntu.com-20080704063220-5s2il1ok2ik8bkzo
parent: robertc at robertcollins.net-20080704070119-qskk0ewwpxpzlfkl
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-07-04 08:21:29 +0100
message:
  (robertc) Add -Dmemory for quick memory gathering. (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
    ------------------------------------------------------------
    revno: 3515.3.2
    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-07-04 03:56:20 +0000
+++ b/NEWS	2008-07-04 07:21:29 +0000
@@ -83,6 +83,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