summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-10-23 09:44:58 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-10-23 09:44:58 -0400
commit466c3873184a0112de3f656d4a99eb80372ea513 (patch)
tree13e1df8c62023d98eb4ec5b91832b57761f5a140 /util
parent274d2670a1b23bdd2ec38a6f63bd48413e4e3b5c (diff)
parentd2856c2fde201ab1d41507ba09d088e51b35cf6c (diff)
downloadgem5-466c3873184a0112de3f656d4a99eb80372ea513.tar.xz
Merge zizzer.eecs.umich.edu:/bk/newmem
into zeep.eecs.umich.edu:/home/gblack/m5/newmem --HG-- extra : convert_revision : cb15101d24ef2969e1819d6bdeeb2dd1f23f02d1
Diffstat (limited to 'util')
-rwxr-xr-xutil/tracediff62
1 files changed, 51 insertions, 11 deletions
diff --git a/util/tracediff b/util/tracediff
index f2377a999..b25efe9b2 100755
--- a/util/tracediff
+++ b/util/tracediff
@@ -33,23 +33,63 @@
# ******Note that you need to enable some trace flags in the args in order
# to do anything useful!******
#
-# If you want to pass different arguments to the two instances of m5,
-# you can embed them in the simulator arguments like this:
+# Script arguments are handled uniformly as follows:
+# - If the argument does not contain a '|' character, it is appended
+# to both command lines.
+# - If the argument has a '|' character in it, the text on either side
+# of the '|' is appended to the respective command lines. Note that
+# you'll have to quote the arg or escape the '|' with a backslash
+# so that the shell doesn't think you're doing a pipe.
#
-# % tracediff "m5.opt --option1" "m5.opt --option2" [common args]
+# In other words, the arguments should look like the command line you
+# want to run, with "|" used to list the alternatives for the parts
+# that you want to differ between the two runs.
+#
+# For example:
+#
+# % tracediff m5.opt --opt1 "--opt2|--opt3" --opt4
+# would compare these two runs:
+# m5.opt --opt1 --opt2 --opt4
+# m5.opt --opt1 --opt3 --opt4
+#
+# If you want to compare two different simulator binaries, put a '|'
+# in the first script argument ("path1/m5.opt|path2/m5.opt"). If you
+# want to add arguments to one run only, just put a '|' in with text
+# only on one side ("--onlyOn1|"). You can do this with multiple
+# arguments together too ("|-a -b -c" adds three args to the second
+# run only).
#
if (@ARGV < 2) {
- die "Usage: tracediff sim1 sim2 [--root.trace.flags=X args...]\n";
+ die "Usage: tracediff \"sim1|sim2\" [common-arg \"arg1|arg2\" ...]\n";
+}
+
+foreach $arg (@ARGV) {
+ @pair = split('\|', $arg, -1); # -1 enables null trailing fields
+ if ($#pair > 0) {
+ push @cmd1, $pair[0];
+ push @cmd2, $pair[1];
+ } else {
+ push @cmd1, $arg;
+ push @cmd2, $arg;
+ }
}
# First two args are the two simulator binaries to compare
-$sim1 = shift;
-$sim2 = shift;
+$sim1 = shift @cmd1;
+$sim2 = shift @cmd2;
+
+# Everything else is a simulator arg.
+$args1 = join(' ', @cmd1);
+$args2 = join(' ', @cmd2);
-# Everything else on the command line is taken to be an m5 argument to
-# be given to both invocations
-$simargs = '"' . join('" "', @ARGV) . '"';
+# Common mistake: if you don't set any traceflags this often isn't
+# doing what you want.
+if ($args1 !~ /--trace-flags/) {
+ print "****\n";
+ print "**** WARNING: no trace flags set... you may not be diffing much!\n";
+ print "****\n";
+}
# Run individual invocations in separate dirs so output and intermediate
# files (particularly config.py and config.ini) don't conflict.
@@ -58,8 +98,8 @@ $dir2 = "tracediff-$$-2";
mkdir($dir1) or die "Can't create dir $dir1\n";
mkdir($dir2) or die "Can't create dir $dir2\n";
-$cmd1 = "$sim1 -d $dir1 $simargs 2>&1 |";
-$cmd2 = "$sim2 -d $dir2 $simargs 2>&1 |";
+$cmd1 = "$sim1 -d $dir1 $args1 2>&1 |";
+$cmd2 = "$sim2 -d $dir2 $args2 2>&1 |";
# This only works if you have rundiff in your path. I just edit it
# with an explicit path if necessary.