Rev 2: show milliseconds rather than seconds. and use time.clock() for cpu time in http://bzr.arbash-meinel.com/plugins/bench_patience

John Arbash Meinel john at arbash-meinel.com
Tue Dec 4 15:55:42 GMT 2007


At http://bzr.arbash-meinel.com/plugins/bench_patience

------------------------------------------------------------
revno: 2
revision-id:john at arbash-meinel.com-20071204155434-y7y3a2qg7wph0c9s
parent: john at arbash-meinel.com-20071204154317-awmijsr5fixg7dg1
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bench_patience
timestamp: Tue 2007-12-04 09:54:34 -0600
message:
  show milliseconds rather than seconds. and use time.clock() for cpu time
modified:
  __init__.py                    __init__.py-20071204154123-hrdofqdugj0iwxcy-1
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-12-04 15:43:17 +0000
+++ b/__init__.py	2007-12-04 15:54:34 +0000
@@ -43,28 +43,28 @@
             texts = w.get_line_list(versions)
             total_len = sum(len(t) for t in texts)
             self.outf.write('%d total bytes\n' % total_len)
-            last_text = ''
+            last_text = []
             from bzrlib.patiencediff import PatienceSequenceMatcher
             times = []
             pb = ui.ui_factory.nested_progress_bar()
             try:
-                t_overall_start = time.time()
+                t_overall_start = time.clock()
                 for idx, text in enumerate(texts):
                     pb.update('comparing', idx, len(texts))
                     matcher = PatienceSequenceMatcher(None, last_text, text)
                     last_text = text
-                    t_start = time.time()
+                    t_start = time.clock()
                     matcher.get_matching_blocks()
-                    t_delta = time.time() - t_start
+                    t_delta = time.clock() - t_start
                     times.append(t_delta)
-                total_time = time.time() - t_overall_start
+                total_time = time.clock() - t_overall_start
             finally:
                 pb.finished()
             avg = sum(times) / float(len(times))
             max_time = max(times)
             min_time = min(times)
-            print 'Total: %.3fs, min: %.3fs avg: %.3fs max: %.3fs' % (
-                total_time, min_time, avg, max_time)
+            print 'Total: %.3fs, min: %.3fms avg: %.3fms max: %.3fms' % (
+                total_time, min_time*1000, avg*1000, max_time*1000)
         finally:
             tree.unlock()
 



More information about the bazaar-commits mailing list