changeset 14522:7c36ec150036

Make the DuplicateSuppressingStream periodically print while it is filtering output
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 13 Mar 2014 15:48:36 +0100
parents 29ccc4cbabca
children 5e55de0379d9 4823ccaf5023
files mxtool/mx.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Wed Mar 12 13:30:08 2014 +0100
+++ b/mxtool/mx.py	Thu Mar 13 15:48:36 2014 +0100
@@ -1276,6 +1276,8 @@
         self.restrictTo = restrictTo
         self.seen = set()
         self.out = out
+        self.currentFilteredLineCount = 0
+        self.currentFilteredTime = None
 
     def isSuppressionCandidate(self, line):
         if self.restrictTo:
@@ -1289,9 +1291,18 @@
     def write(self, line):
         if self.isSuppressionCandidate(line):
             if line in self.seen:
+                self.currentFilteredLineCount += 1
+                if self.currentFilteredTime:
+                    if time.time() - self.currentFilteredTime > 1 * 60:
+                        self.out.write("  Filtered " + str(self.currentFilteredLineCount) + " repeated lines...\n")
+                        self.currentFilteredTime = time.time()
+                else:
+                    self.currentFilteredTime = time.time()
                 return
             self.seen.add(line)
+        self.currentFilteredLineCount = 0
         self.out.write(line)
+        self.currentFilteredTime = None
 
 """
 A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string.