tracediff revision 1372
12139SN/A#! /usr/bin/env perl 22139SN/A# Copyright (c) 2003-2005 The Regents of The University of Michigan 32139SN/A# All rights reserved. 42139SN/A# 52139SN/A# Redistribution and use in source and binary forms, with or without 62139SN/A# modification, are permitted provided that the following conditions are 72139SN/A# met: redistributions of source code must retain the above copyright 82139SN/A# notice, this list of conditions and the following disclaimer; 92139SN/A# redistributions in binary form must reproduce the above copyright 102139SN/A# notice, this list of conditions and the following disclaimer in the 112139SN/A# documentation and/or other materials provided with the distribution; 122139SN/A# neither the name of the copyright holders nor the names of its 132139SN/A# contributors may be used to endorse or promote products derived from 142139SN/A# this software without specific prior written permission. 152139SN/A# 162139SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172139SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182139SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192139SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202139SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212139SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222139SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232139SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242139SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252139SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262139SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272139SN/A# 282665Ssaidi@eecs.umich.edu# Authors: Steve Reinhardt 292665Ssaidi@eecs.umich.edu 302139SN/A# Script to simplify using rundiff on trace outputs from two 312718Sstever@eecs.umich.edu# invocations of m5. 322139SN/A# 332139SN/A# Note that you need to enable some trace flags in the args in order 342139SN/A# to do anything useful! 352139SN/A# 362152SN/A# If you want to pass different arguments to the two instances of m5, 372152SN/A# you can embed them in the simulator arguments like this: 382152SN/A# 392152SN/A# % tracediff "m5.opt --foo:bar=1" "m5.opt --foo:bar=2" [common args] 402139SN/A# 412139SN/A 422139SN/Aif (@ARGV < 2) { 432139SN/A die "Usage: tracediff sim1 sim2 [--trace:flags=X args...]\n"; 442139SN/A} 452152SN/A 462152SN/A# First two args are the two simulator binaries to compare 472139SN/A$sim1 = shift; 482139SN/A$sim2 = shift; 492139SN/A 502984Sgblack@eecs.umich.edu# Everything else on the command line is taken to be an m5 argument to 512439SN/A# be given to both invocations 523520Sgblack@eecs.umich.edu$simargs = '"' . join('" "', @ARGV) . '"'; 532139SN/A 543170Sstever@eecs.umich.edu# Redirect config output to cout so that gets diffed too (in case 552439SN/A# that's the source of the problem). 562460SN/A$simargs .= " --root:config_output_file=cout"; 572439SN/A 582972Sgblack@eecs.umich.edu$cmd1 = "$sim1 $simargs --stats:text_file=tracediff-$$-1.stats 2>&1 |"; 592171SN/A$cmd2 = "$sim2 $simargs --stats:text_file=tracediff-$$-2.stats 2>&1 |"; 602439SN/A 612439SN/A# This only works if you have rundiff in your path. I just edit it 622170SN/A# with an explicit path if necessary. 632139SN/A$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out"; 642139SN/A 652139SN/Aprint "Executing $fullcmd\n"; 662139SN/Asystem($fullcmd); 672139SN/A 682139SN/A 692139SN/A 702139SN/A