home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / demos / x11perf / x11pcomp.cpp < prev    next >
Encoding:
Text File  |  1991-08-22  |  2.7 KB  |  101 lines

  1. XCOMM! /bin/sh
  2. XCOMM Collects multiple outputs of x11perf.  Just feed it a list of files, each
  3. XCOMM containing the output from an x11perf run, and this shell will extract the
  4. XCOMM object/second information and show it in tabular form.  An 80-column line
  5. XCOMM is big enough to compare 4 different servers.
  6. XCOMM
  7. XCOMM This script normally uses the results from $1 to extract the test label
  8. XCOMM descriptions, so you can run x11perf on a subset of the test and then
  9. XCOMM compare the results.  But note that x11perffill requires the labels file
  10. XCOMM to be a superset of the x11perf results file.  If you run into an ugly
  11. XCOMM situation in which none of the servers completes the desired tests 
  12. XCOMM (quite possible on non-DEC servers :), you can use -l <filename> as $1 and
  13. XCOMM $2 to force x11perfcomp to use the labels stored in file $2.  (You can run
  14. XCOMM x11perf with the -labels option to generate such a file.)
  15. XCOMM
  16. XCOMM Mark Moraes, University of Toronto <moraes@csri.toronto.edu>
  17. XCOMM Joel McCormack, DEC Western Research Lab <joel@decwrl.dec.com>
  18. XCOMM
  19. XCOMM $XConsortium: x11pcomp.cpp,v 1.6 91/08/22 11:43:57 rws Exp $
  20.  
  21. PATH=LIBPATH:.:$PATH
  22. export PATH
  23.  
  24. set -e
  25. tmp=/tmp/rates.$$
  26. trap "rm -rf $tmp" 0 1 2 15
  27. mkdir $tmp $tmp/rates
  28. ratio=
  29. allfiles=
  30. XCOMM Include relative rates in output?  Report only relative rates?
  31. case $1 in
  32. -r|-a)
  33.     ratio=1
  34.     shift;
  35.     ;;
  36. -ro)
  37.     ratio=2
  38.     shift;
  39.     ;;
  40. esac
  41. XCOMM Get either the provided label file, or construct one from all the
  42. XCOMM files given.
  43. case $1 in
  44. -l)    cp $2 $tmp/labels
  45.     shift; shift
  46.     ;;
  47. *)    for file in "$@"; do
  48.         awk '$2 == "reps" || $2 == "trep" { print $0; next; }' $file |
  49.          sed 's/^.*: //' |
  50.          sed 's/ /_/g' |
  51.          awk 'NR > 1     { printf ("%s %s\n", prev, $0); }
  52.                 { prev = $0; }'
  53.     done | tsort 2>/dev/null | sed 's/_/ /g' > $tmp/labels
  54.     ;;
  55. esac
  56. XCOMM Go through all files, and create a corresponding rate file for each
  57. n=1
  58. for i
  59. do
  60. XCOMM Get lines with average numbers, fill in any tests that may be missing
  61. XCOMM then extract the rate field
  62.     base=`basename $i`
  63.     (echo "     $n  "
  64.      echo '--------'
  65.      awk '$2 == "reps" || $2 == "trep" {
  66.         line = $0;
  67.         next;
  68.         }
  69.         NF == 0 && line != "" {
  70.         print line;
  71.         line="";
  72.         next;
  73.         }
  74.      ' $i > $tmp/$n.avg
  75.      fillblnk $tmp/$n.avg $tmp/labels |
  76.      sed 's/( *\([0-9]*\)/(\1/'   |
  77.      awk '$2 == "reps" || $2 == "trep" {
  78.                          n = substr($6,2,length($6)-7);
  79.                         printf "%8s\n", n;
  80.                             }'
  81.     ) > $tmp/rates/$n
  82.     echo "$n: $i"
  83.     allfiles="$allfiles$tmp/rates/$n "
  84.     n=`expr $n + 1`
  85. done
  86. case x$ratio in
  87. x)
  88.     ratio=/bin/cat
  89.     ;;
  90. x1)
  91.     ratio="perfboth $n"
  92.     ;;
  93. *)
  94.     ratio="perfratio $n"
  95.     ;;
  96. esac
  97. echo ''
  98. (echo Operation; echo '---------'; cat $tmp/labels) |
  99. paste $allfiles - | sed 's/    /  /g' | $ratio
  100. rm -rf $tmp
  101.