tracediff revision 2783
16019Shines@cs.fsu.edu#! /usr/bin/env perl 26019Shines@cs.fsu.edu# Copyright (c) 2003-2006 The Regents of The University of Michigan 37100Sgblack@eecs.umich.edu# 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 --option1" "m5.opt --option2" [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 [--root.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; 486019Shines@cs.fsu.edu$sim2 = shift; 496019Shines@cs.fsu.edu 506019Shines@cs.fsu.edu# Everything else on the command line is taken to be an m5 argument to 517170Sgblack@eecs.umich.edu# be given to both invocations 526253Sgblack@eecs.umich.edu$simargs = '"' . join('" "', @ARGV) . '"'; 537202Sgblack@eecs.umich.edu 546253Sgblack@eecs.umich.edu# Run individual invocations in separate dirs so output and intermediate 556253Sgblack@eecs.umich.edu# files (particularly config.py and config.ini) don't conflict. 567396Sgblack@eecs.umich.edu$dir1 = "tracediff-$$-1"; 577405SAli.Saidi@ARM.com$dir2 = "tracediff-$$-2"; 587259Sgblack@eecs.umich.edumkdir($dir1) or die "Can't create dir $dir1\n"; 597423Sgblack@eecs.umich.edumkdir($dir2) or die "Can't create dir $dir2\n"; 606397Sgblack@eecs.umich.edu 616019Shines@cs.fsu.edu$cmd1 = "$sim1 $simargs -d $dir1 2>&1 |"; 626757SAli.Saidi@ARM.com$cmd2 = "$sim2 $simargs -d $dir2 2>&1 |"; 637752SWilliam.Wang@arm.com 646019Shines@cs.fsu.edu# This only works if you have rundiff in your path. I just edit it 656397Sgblack@eecs.umich.edu# with an explicit path if necessary. 666019Shines@cs.fsu.edu$fullcmd = "rundiff '$cmd1' '$cmd2' 2>&1 > tracediff-$$.out"; 676397Sgblack@eecs.umich.edu 686019Shines@cs.fsu.eduprint "Executing $fullcmd\n"; 697404SAli.Saidi@ARM.comsystem($fullcmd); 706735Sgblack@eecs.umich.edu 717100Sgblack@eecs.umich.edu 726019Shines@cs.fsu.edu 736757SAli.Saidi@ARM.com