home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / bin / x11perfcomp < prev    next >
Encoding:
Text File  |  1996-10-17  |  2.6 KB  |  101 lines

  1. #! /bin/sh
  2. # Collects multiple outputs of x11perf.  Just feed it a list of files, each
  3. # containing the output from an x11perf run, and this shell will extract the
  4. # object/second information and show it in tabular form.  An 80-column line
  5. # is big enough to compare 4 different servers.
  6. #
  7. # This script normally uses the results from $1 to extract the test label
  8. # descriptions, so you can run x11perf on a subset of the test and then
  9. # compare the results.  But note that x11perffill requires the labels file
  10. # to be a superset of the x11perf results file.  If you run into an ugly
  11. # situation in which none of the servers completes the desired tests 
  12. # (quite possible on non-DEC servers :), you can use -l <filename> as $1 and
  13. # $2 to force x11perfcomp to use the labels stored in file $2.  (You can run
  14. # x11perf with the -labels option to generate such a file.)
  15. #
  16. # Mark Moraes, University of Toronto <moraes@csri.toronto.edu>
  17. # Joel McCormack, DEC Western Research Lab <joel@decwrl.dec.com>
  18. #
  19. # $XConsortium: x11pcomp.cpp,v 1.6 91/08/22 11:43:57 rws Exp $
  20.  
  21. PATH=/usr/X11R6.1/lib/X11/x11perfcomp:.:$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. # 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. # Get either the provided label file, or construct one from all the
  42. # 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. # Go through all files, and create a corresponding rate file for each
  57. n=1
  58. for i
  59. do
  60. # Get lines with average numbers, fill in any tests that may be missing
  61. # 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.