ARM: Add RTC device for ARM platforms.
[gem5.git] / util / rundiff
index 63c05b96be8fdd8e84a8f5dfe3860972591e8508..7e0a7705722620b4ed98a3a1839b00a716dd4d30 100755 (executable)
@@ -25,6 +25,9 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Nathan Binkert
+#          Steve Reinhardt
 
 # Diff two streams.
 #
 # "filename" is a pipe (|).  Thus to compare the instruction traces
 # from two versions of m5 (m5a and m5b), you can do this:
 #
-# rundiff 'm5a --trace:flags=InstExec |' 'm5b --trace:flags=InstExec |'
+# rundiff 'm5a --traceflags=InstExec |' 'm5b --traceflags=InstExec |'
 #
 
 use strict;
-
+use FileHandle;
 use Getopt::Std;
 
 #
@@ -87,6 +90,10 @@ my ($fh1, $fh2);
 open($fh1, $file1) or die "Can't open $file1";
 open($fh2, $file2) or die "Can't open $file2";
 
+# print files to output so we know which is which
+print "-$file1\n";
+print "+$file2\n";
+
 # buffer of matching lines for pre-diff context
 my @precontext = ();
 # number of post-diff matching lines remaining to print
@@ -158,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();
+    }
 }
 
 
@@ -282,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