tracediff revision 1372
15131Sgblack@eecs.umich.edu#! /usr/bin/env perl
25131Sgblack@eecs.umich.edu# Copyright (c) 2003-2005 The Regents of The University of Michigan
35131Sgblack@eecs.umich.edu# All rights reserved.
45131Sgblack@eecs.umich.edu#
55131Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
65131Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
75131Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
85131Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
95131Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
105131Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
115131Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
125131Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
135131Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
145131Sgblack@eecs.umich.edu# this software without specific prior written permission.
155131Sgblack@eecs.umich.edu#
165131Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175131Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185131Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195131Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205131Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215131Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225131Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235131Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245131Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255131Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265131Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275131Sgblack@eecs.umich.edu#
285131Sgblack@eecs.umich.edu# Authors: Steve Reinhardt
295390Sgblack@eecs.umich.edu
305131Sgblack@eecs.umich.edu# Script to simplify using rundiff on trace outputs from two
315131Sgblack@eecs.umich.edu# invocations of m5.
325131Sgblack@eecs.umich.edu#
338739Sgblack@eecs.umich.edu# Note that you need to enable some trace flags in the args in order
345638Sgblack@eecs.umich.edu# to do anything useful!
355629Sgblack@eecs.umich.edu#
365131Sgblack@eecs.umich.edu# If you want to pass different arguments to the two instances of m5,
375637Sgblack@eecs.umich.edu# you can embed them in the simulator arguments like this:
385637Sgblack@eecs.umich.edu#
395637Sgblack@eecs.umich.edu# % tracediff "m5.opt --foo:bar=1" "m5.opt --foo:bar=2" [common args]
405629Sgblack@eecs.umich.edu#
415629Sgblack@eecs.umich.edu
428335Snate@binkert.orgif (@ARGV < 2) {
435630Sgblack@eecs.umich.edu    die "Usage: tracediff sim1 sim2 [--trace:flags=X args...]\n";
445630Sgblack@eecs.umich.edu}
455630Sgblack@eecs.umich.edu
468335Snate@binkert.org# First two args are the two simulator binaries to compare
475633Sgblack@eecs.umich.edu$sim1 = shift;
485636Sgblack@eecs.umich.edu$sim2 = shift;
495636Sgblack@eecs.umich.edu
508335Snate@binkert.org# Everything else on the command line is taken to be an m5 argument to
515636Sgblack@eecs.umich.edu# be given to both invocations
525818Sgblack@eecs.umich.edu$simargs = '"' . join('" "', @ARGV) . '"';
535818Sgblack@eecs.umich.edu
548335Snate@binkert.org# Redirect config output to cout so that gets diffed too (in case
555818Sgblack@eecs.umich.edu# that's the source of the problem).
565831Sgblack@eecs.umich.edu$simargs .= " --root:config_output_file=cout";
575831Sgblack@eecs.umich.edu
588335Snate@binkert.org$cmd1 = "$sim1 $simargs --stats:text_file=tracediff-$$-1.stats 2>&1 |";
595831Sgblack@eecs.umich.edu$cmd2 = "$sim2 $simargs --stats:text_file=tracediff-$$-2.stats 2>&1 |";
605636Sgblack@eecs.umich.edu
615636Sgblack@eecs.umich.edu# This only works if you have rundiff in your path.  I just edit it
628335Snate@binkert.org# with an explicit path if necessary.
635636Sgblack@eecs.umich.edu$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out";
645643Sgblack@eecs.umich.edu
655643Sgblack@eecs.umich.eduprint "Executing $fullcmd\n";
668335Snate@binkert.orgsystem($fullcmd);
675643Sgblack@eecs.umich.edu
685633Sgblack@eecs.umich.edu
695633Sgblack@eecs.umich.edu
709807Sstever@gmail.com