tracediff revision 1372
16019Shines@cs.fsu.edu#! /usr/bin/env perl
26019Shines@cs.fsu.edu# Copyright (c) 2003-2005 The Regents of The University of Michigan
310037SARM gem5 Developers# All rights reserved.
47100Sgblack@eecs.umich.edu#
57100Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
67100Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
77100Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
87100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
97100Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
107100Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
117100Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
127100Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
137100Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
147100Sgblack@eecs.umich.edu# this software without specific prior written permission.
156019Shines@cs.fsu.edu#
166019Shines@cs.fsu.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176019Shines@cs.fsu.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186019Shines@cs.fsu.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196019Shines@cs.fsu.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206019Shines@cs.fsu.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216019Shines@cs.fsu.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226019Shines@cs.fsu.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236019Shines@cs.fsu.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246019Shines@cs.fsu.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256019Shines@cs.fsu.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266019Shines@cs.fsu.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276019Shines@cs.fsu.edu#
286019Shines@cs.fsu.edu# Authors: Steve Reinhardt
296019Shines@cs.fsu.edu
306019Shines@cs.fsu.edu# Script to simplify using rundiff on trace outputs from two
316019Shines@cs.fsu.edu# invocations of m5.
326019Shines@cs.fsu.edu#
336019Shines@cs.fsu.edu# Note that you need to enable some trace flags in the args in order
346019Shines@cs.fsu.edu# to do anything useful!
356019Shines@cs.fsu.edu#
366019Shines@cs.fsu.edu# If you want to pass different arguments to the two instances of m5,
376019Shines@cs.fsu.edu# you can embed them in the simulator arguments like this:
386019Shines@cs.fsu.edu#
396019Shines@cs.fsu.edu# % tracediff "m5.opt --foo:bar=1" "m5.opt --foo:bar=2" [common args]
406019Shines@cs.fsu.edu#
416019Shines@cs.fsu.edu
426757SAli.Saidi@ARM.comif (@ARGV < 2) {
436019Shines@cs.fsu.edu    die "Usage: tracediff sim1 sim2 [--trace:flags=X args...]\n";
446019Shines@cs.fsu.edu}
456019Shines@cs.fsu.edu
466019Shines@cs.fsu.edu# First two args are the two simulator binaries to compare
476019Shines@cs.fsu.edu$sim1 = shift;
4811320Ssteve.reinhardt@amd.com$sim2 = shift;
496019Shines@cs.fsu.edu
509022Sgblack@eecs.umich.edu# Everything else on the command line is taken to be an m5 argument to
516019Shines@cs.fsu.edu# be given to both invocations
5210037SARM gem5 Developers$simargs = '"' . join('" "', @ARGV) . '"';
5310037SARM gem5 Developers
547170Sgblack@eecs.umich.edu# Redirect config output to cout so that gets diffed too (in case
556253Sgblack@eecs.umich.edu# that's the source of the problem).
5610037SARM gem5 Developers$simargs .= " --root:config_output_file=cout";
577202Sgblack@eecs.umich.edu
5810037SARM gem5 Developers$cmd1 = "$sim1 $simargs --stats:text_file=tracediff-$$-1.stats 2>&1 |";
596253Sgblack@eecs.umich.edu$cmd2 = "$sim2 $simargs --stats:text_file=tracediff-$$-2.stats 2>&1 |";
6010611SAndreas.Sandberg@ARM.com
616253Sgblack@eecs.umich.edu# This only works if you have rundiff in your path.  I just edit it
627396Sgblack@eecs.umich.edu# with an explicit path if necessary.
6310037SARM gem5 Developers$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out";
648745Sgblack@eecs.umich.edu
657405SAli.Saidi@ARM.comprint "Executing $fullcmd\n";
6610461SAndreas.Sandberg@ARM.comsystem($fullcmd);
678782Sgblack@eecs.umich.edu
688782Sgblack@eecs.umich.edu
698782Sgblack@eecs.umich.edu
7010810Sbr@bsdpad.com