tracediff revision 2783
1247Sstever@eecs.umich.edu#! /usr/bin/env perl
22783Sktlim@umich.edu# Copyright (c) 2003-2006 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#
331746Shsul@eecs.umich.edu# ******Note that you need to enable some trace flags in the args in order
341746Shsul@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#
392783Sktlim@umich.edu# % tracediff "m5.opt --option1" "m5.opt --option2" [common args]
401123Sstever@eecs.umich.edu#
41247Sstever@eecs.umich.edu
42247Sstever@eecs.umich.eduif (@ARGV < 2) {
431746Shsul@eecs.umich.edu    die "Usage: tracediff sim1 sim2 [--root.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
541442Sstever@eecs.umich.edu# Run individual invocations in separate dirs so output and intermediate
551442Sstever@eecs.umich.edu# files (particularly config.py and config.ini) don't conflict.
561442Sstever@eecs.umich.edu$dir1 = "tracediff-$$-1";
571442Sstever@eecs.umich.edu$dir2 = "tracediff-$$-2";
581442Sstever@eecs.umich.edumkdir($dir1) or die "Can't create dir $dir1\n";
591442Sstever@eecs.umich.edumkdir($dir2) or die "Can't create dir $dir2\n";
601123Sstever@eecs.umich.edu
611442Sstever@eecs.umich.edu$cmd1 = "$sim1 $simargs -d $dir1 2>&1 |";
621442Sstever@eecs.umich.edu$cmd2 = "$sim2 $simargs -d $dir2 2>&1 |";
63247Sstever@eecs.umich.edu
64247Sstever@eecs.umich.edu# This only works if you have rundiff in your path.  I just edit it
65247Sstever@eecs.umich.edu# with an explicit path if necessary.
66247Sstever@eecs.umich.edu$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out";
67247Sstever@eecs.umich.edu
68247Sstever@eecs.umich.eduprint "Executing $fullcmd\n";
69247Sstever@eecs.umich.edusystem($fullcmd);
70247Sstever@eecs.umich.edu
71247Sstever@eecs.umich.edu
72247Sstever@eecs.umich.edu
73