sim: Use the old work item behavior by default
[gem5.git] / util / rundiff
index c34bb53a3fc1e9171b16bfae5630ff5549c321d4..7e0a7705722620b4ed98a3a1839b00a716dd4d30 100755 (executable)
@@ -43,7 +43,7 @@
 #
 
 use strict;
-
+use FileHandle;
 use Getopt::Std;
 
 #
@@ -165,6 +165,12 @@ sub printdiff
 
     # Set $postcontext to print the next $postcontext_lines matching lines.
     $postcontext = $postcontext_lines;
+
+    # Normally we flush after the postcontext lines are printed, but if
+    # the user has decreed that there aren't any we need to flush now
+    if ($postcontext == 0) {
+        STDOUT->flush();
+    }
 }
 
 
@@ -289,10 +295,12 @@ while (1) {
        # figure out what to do with this line
        if ($postcontext > 0) {
            # we're in the post-context of a diff: print it
-           $postcontext--;
            print ' ', $l1;
            $lineno1++;
            $lineno2++;
+            if (--$postcontext == 0) {
+                STDOUT->flush();
+            }
        }
        else {
            # we're in the middle of a matching region... save this