[pypy-svn] r40176 - in pypy/dist/pypy: rpython tool

xoraxax at codespeak.net xoraxax at codespeak.net
Sat Mar 10 19:28:07 CET 2007


Author: xoraxax
Date: Sat Mar 10 19:28:05 2007
New Revision: 40176

Modified:
   pypy/dist/pypy/rpython/rtyper.py
   pypy/dist/pypy/tool/ansi_print.py
Log:
Show rtyper progress only every 5 percent, get line breaks right for messages after the dots.

Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Sat Mar 10 19:28:05 2007
@@ -218,6 +218,7 @@
             else:
                 tracking = lambda block: None
 
+            previous_percentage = 0
             # specialize all blocks in the 'pending' list
             for block in pending:
                 tracking(block)
@@ -228,12 +229,15 @@
                 n = len(self.already_seen)
                 if n % 100 == 0:
                     total = len(self.annotator.annotated)
-                    if self.typererror_count:
-                        error_report = " but %d errors" % self.typererror_count
-                    else:
-                        error_report = ''
-                    self.log.event('specializing: %d / %d blocks   (%d%%)%s' %
-                                   (n, total, 100 * n // total, error_report))
+                    percentage = 100 * n // total
+                    if percentage >= previous_percentage + 5:
+                        previous_percentage = percentage
+                        if self.typererror_count:
+                            error_report = " but %d errors" % self.typererror_count
+                        else:
+                            error_report = ''
+                        self.log.event('specializing: %d / %d blocks   (%d%%)%s' %
+                                       (n, total, percentage, error_report))
             # make sure all reprs so far have had their setup() called
             self.call_all_setups()
 

Modified: pypy/dist/pypy/tool/ansi_print.py
==============================================================================
--- pypy/dist/pypy/tool/ansi_print.py	(original)
+++ pypy/dist/pypy/tool/ansi_print.py	Sat Mar 10 19:28:05 2007
@@ -7,6 +7,7 @@
 from py.__.misc.terminal_helper import ansi_print
 
 class AnsiLog:
+    wrote_dot = False # XXX sharing state with all instances
 
     KW_TO_COLOR = {
         # color supress
@@ -47,7 +48,11 @@
         elif 'dot' in keywords:
             if tty:
                 sys.stderr.write(".")
+                AnsiLog.wrote_dot = True
                 return
+        if AnsiLog.wrote_dot:
+            AnsiLog.wrote_dot = False
+            sys.stderr.write("\n")
         esc = tuple(esc)
         for line in msg.content().splitlines():
             ansi_print("[%s] %s" %(":".join(keywords), line), esc, 



More information about the Pypy-commit mailing list