#!/bin/csh -f
#
# udcompare - compare the udtraces of two dmcache output scripts
#
# usage:
#   run dmcache on the same parameters, with and without REAL_DATA
#   capture the output of each in output files, eg, out.real and out.fake
#   grep the ^udtrace lines into, eg, udreal and udfake
#   run "udcompare udreal udfake" to see the places where they differ
#
# Part of
#              The STARFISH Parallel file-system simulator
#        (Simulation Tool for Advanced Research in File Systems)
# 
#                               David Kotz
#                           Dartmouth College
#                              Version 3.0
#                              October 1996
#                          dfk@cs.dartmouth.edu

if ($#argv != 2) then
    echo usage: udcompare udreal udfake
    exit 1
endif

# After abutting, the columns are:
#  1 udreal "udtrace"
#  2 udreal proc
#  3 udreal time
#  4 udreal copybytes
#  5 udreal costbytes
#  6 udreal where
#  7 udfake "udtrace"
#  8 udfake proc
#  9 udfake time
# 10 udfake copybytes
# 11 udfake costbytes
# 12 udfake where

# non-matching costbytes:
abut $1 $2 | awk '$5 != $11 {$1="real"; $7="fake"; print $0}'
