tracediff revision 1372
1247Sstever@eecs.umich.edu#! /usr/bin/env perl
21372Sstever@eecs.umich.edu# Copyright (c) 2003-2005 The Regents of The University of Michigan
3247Sstever@eecs.umich.edu# All rights reserved.
4247Sstever@eecs.umich.edu#
5247Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
6247Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are
7247Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright
8247Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
9247Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
10247Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
11247Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution;
12247Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its
13247Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from
14247Sstever@eecs.umich.edu# this software without specific prior written permission.
15247Sstever@eecs.umich.edu#
16247Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17247Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18247Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19247Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20247Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21247Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22247Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23247Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24247Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25247Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26247Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27247Sstever@eecs.umich.edu#
28247Sstever@eecs.umich.edu# Authors: Steve Reinhardt
29247Sstever@eecs.umich.edu
301123Sstever@eecs.umich.edu# Script to simplify using rundiff on trace outputs from two
311123Sstever@eecs.umich.edu# invocations of m5.
321123Sstever@eecs.umich.edu#
331123Sstever@eecs.umich.edu# Note that you need to enable some trace flags in the args in order
341123Sstever@eecs.umich.edu# to do anything useful!
351123Sstever@eecs.umich.edu#
361123Sstever@eecs.umich.edu# If you want to pass different arguments to the two instances of m5,
371123Sstever@eecs.umich.edu# you can embed them in the simulator arguments like this:
381123Sstever@eecs.umich.edu#
391123Sstever@eecs.umich.edu# % tracediff "m5.opt --foo:bar=1" "m5.opt --foo:bar=2" [common args]
401123Sstever@eecs.umich.edu#
41247Sstever@eecs.umich.edu
42247Sstever@eecs.umich.eduif (@ARGV < 2) {
431123Sstever@eecs.umich.edu    die "Usage: tracediff sim1 sim2 [--trace:flags=X args...]\n";
44247Sstever@eecs.umich.edu}
45247Sstever@eecs.umich.edu
46247Sstever@eecs.umich.edu# First two args are the two simulator binaries to compare
47247Sstever@eecs.umich.edu$sim1 = shift;
48247Sstever@eecs.umich.edu$sim2 = shift;
49247Sstever@eecs.umich.edu
50247Sstever@eecs.umich.edu# Everything else on the command line is taken to be an m5 argument to
51247Sstever@eecs.umich.edu# be given to both invocations
52579Sstever@eecs.umich.edu$simargs = '"' . join('" "', @ARGV) . '"';
53247Sstever@eecs.umich.edu
541123Sstever@eecs.umich.edu# Redirect config output to cout so that gets diffed too (in case
551123Sstever@eecs.umich.edu# that's the source of the problem).
561372Sstever@eecs.umich.edu$simargs .= " --root:config_output_file=cout";
571123Sstever@eecs.umich.edu
58704Sstever@eecs.umich.edu$cmd1 = "$sim1 $simargs --stats:text_file=tracediff-$$-1.stats 2>&1 |";
59704Sstever@eecs.umich.edu$cmd2 = "$sim2 $simargs --stats:text_file=tracediff-$$-2.stats 2>&1 |";
60247Sstever@eecs.umich.edu
61247Sstever@eecs.umich.edu# This only works if you have rundiff in your path.  I just edit it
62247Sstever@eecs.umich.edu# with an explicit path if necessary.
63247Sstever@eecs.umich.edu$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out";
64247Sstever@eecs.umich.edu
65247Sstever@eecs.umich.eduprint "Executing $fullcmd\n";
66247Sstever@eecs.umich.edusystem($fullcmd);
67247Sstever@eecs.umich.edu
68247Sstever@eecs.umich.edu
69247Sstever@eecs.umich.edu
70