Rev 3171: (andrew) Add -Dtimes debug flag. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jan 10 01:15:53 GMT 2008


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

------------------------------------------------------------
revno: 3171
revision-id:pqm at pqm.ubuntu.com-20080110011547-97smthgbb8hfshs7
parent: pqm at pqm.ubuntu.com-20080107174938-hvwo399dzshh3cod
parent: andrew.bennetts at canonical.com-20080109232145-31w2ijecmaefb9dr
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-01-10 01:15:47 +0000
message:
  (andrew) Add -Dtimes debug flag.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
  bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
    ------------------------------------------------------------
    revno: 3170.1.2
    revision-id:andrew.bennetts at canonical.com-20080109232145-31w2ijecmaefb9dr
    parent: andrew.bennetts at canonical.com-20080109070423-kfmpx0s8mcb8sy8p
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: debug-timestamps
    timestamp: Thu 2008-01-10 10:21:45 +1100
    message:
      Update test_resource_string for new debug.py contents.
    modified:
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
    ------------------------------------------------------------
    revno: 3170.1.1
    revision-id:andrew.bennetts at canonical.com-20080109070423-kfmpx0s8mcb8sy8p
    parent: pqm at pqm.ubuntu.com-20080107174938-hvwo399dzshh3cod
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: debug-timestamps
    timestamp: Wed 2008-01-09 18:04:23 +1100
    message:
      Add -Dtimes, which adds a timestamp to mutters (using the time since the first mutter).
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
=== modified file 'NEWS'
--- a/NEWS	2008-01-07 16:47:46 +0000
+++ b/NEWS	2008-01-09 07:04:23 +0000
@@ -141,23 +141,26 @@
 
   INTERNALS:
 
-    * find_* methods available for BzrDirs, Branches and WorkingTrees.
-      (Aaron Bentley)
-
-    * Help topics can now be loaded from files. 
-      (Ian Clatworthy, Alexander Belchenko)
-
-    * get_parent_map now always provides tuples as its output.  (Aaron Bentley)
-
-    * Parent Providers should now implement ``get_parent_map`` returning a
-      dictionary instead of ``get_parents`` returning a list.
-      ``get_parents`` is now considered deprecated.  (John Arbash Meinel)
-
-    * Patience Diff now supports arbitrary python objects, as long as they
-      support ``hash()``. (John Arbash Meinel)
-
-    * Reduce selftest overhead to establish test names by memoization.
-      (Vincent Ladeuil)
+   * Add -Dtimes debug flag, which records a timestamp against each mutter to
+     the trace file, relative to the first mutter.  (Andrew Bennetts)
+    
+   * find_* methods available for BzrDirs, Branches and WorkingTrees.
+     (Aaron Bentley)
+
+   * Help topics can now be loaded from files. 
+     (Ian Clatworthy, Alexander Belchenko)
+
+   * get_parent_map now always provides tuples as its output.  (Aaron Bentley)
+
+   * Parent Providers should now implement ``get_parent_map`` returning a
+     dictionary instead of ``get_parents`` returning a list.
+     ``get_parents`` is now considered deprecated.  (John Arbash Meinel)
+
+   * Patience Diff now supports arbitrary python objects, as long as they
+     support ``hash()``. (John Arbash Meinel)
+
+   * Reduce selftest overhead to establish test names by memoization.
+     (Vincent Ladeuil)
 
   API BREAKS:
 

=== modified file 'bzrlib/debug.py'
--- a/bzrlib/debug.py	2007-12-06 17:52:30 +0000
+++ b/bzrlib/debug.py	2008-01-09 07:04:23 +0000
@@ -16,7 +16,7 @@
 
 
 # NOTE: If update these, please also update the help for global-options in
-#       bzrlib/help_topics.py.
+#       bzrlib/help_topics/__init__.py
 
 debug_flags = set()
 """Set of flags that enable different debug behaviour.
@@ -29,11 +29,13 @@
  * error - show stack traces for all top level exceptions
  * evil - capture call sites that do expensive or badly-scaling operations.
  * fetch - trace history copying between repositories
+ * hashcache - log every time a working file is read to determine its hash
  * hooks - trace hook execution
  * hpss - trace smart protocol requests and responses
  * http - trace http connections, requests and responses
  * index - trace major index operations
  * lock - trace when lockdir locks are taken or released
  * merge - emit information for debugging merges
+ * times - record timestamps from program start in trace file
 
 """

=== modified file 'bzrlib/help_topics/__init__.py'
--- a/bzrlib/help_topics/__init__.py	2008-01-03 02:17:12 +0000
+++ b/bzrlib/help_topics/__init__.py	2008-01-09 07:04:23 +0000
@@ -281,13 +281,15 @@
                error.
 -Devil         Capture call sites that do expensive or badly-scaling
                operations.
+-Dfetch        Trace history copying between repositories.
 -Dhashcache    Log every time a working file is read to determine its hash.
 -Dhooks        Trace hook execution.
+-Dhpss         Trace smart protocol requests and responses.
 -Dhttp         Trace http connections, requests and responses
--Dhpss         Trace smart protocol requests and responses.
 -Dindex        Trace major index operations.
 -Dlock         Trace when lockdir locks are taken or released.
 -Dmerge        Emit information for debugging merges.
+-Dtimes        Record timestamps from program start in trace file.
 """
 
 _standard_options = \

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2007-12-27 08:25:04 +0000
+++ b/bzrlib/tests/test_osutils.py	2008-01-09 23:21:45 +0000
@@ -1096,7 +1096,7 @@
 
 
 # NOTE: If update these, please also update the help for global-options in
-#       bzrlib/help_topics.py.
+#       bzrlib/help_topics/__init__.py
 
 debug_flags = set()
 """Set of flags that enable different debug behaviour.
@@ -1109,12 +1109,14 @@
  * error - show stack traces for all top level exceptions
  * evil - capture call sites that do expensive or badly-scaling operations.
  * fetch - trace history copying between repositories
+ * hashcache - log every time a working file is read to determine its hash
  * hooks - trace hook execution
  * hpss - trace smart protocol requests and responses
  * http - trace http connections, requests and responses
  * index - trace major index operations
  * lock - trace when lockdir locks are taken or released
  * merge - emit information for debugging merges
+ * times - record timestamps from program start in trace file
 
 """
 '''

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2007-12-27 11:46:11 +0000
+++ b/bzrlib/trace.py	2008-01-09 07:04:23 +0000
@@ -55,6 +55,7 @@
 import os
 import sys
 import re
+import time
 
 from bzrlib.lazy_import import lazy_import
 lazy_import(globals(), """
@@ -82,6 +83,7 @@
 _trace_depth = 0
 _bzr_log_file = None
 _bzr_log_filename = None
+_bzr_log_opened = None
 
 
 # configure convenient aliases for output routines
@@ -127,6 +129,14 @@
     else:
         out = fmt
     out += '\n'
+    if 'times' in debug.debug_flags:
+        global _bzr_log_opened
+        if _bzr_log_opened is None:
+            # This is the first mutter since the process started.  Start the
+            # clock from now.
+            _bzr_log_opened = time.time()
+        timestamp = '%0.3f' % (time.time() - _bzr_log_opened,)
+        out = '%s %s' % (timestamp, out)
     _trace_file.write(out)
     # TODO: jam 20051227 Consider flushing the trace file to help debugging
     #_trace_file.flush()




More information about the bazaar-commits mailing list