home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / x11p-13.zip / x11pcomp.cpp < prev    next >
Text File  |  1991-04-30  |  3KB  |  98 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. PATH=LIBPATH:.:$PATH
  20. export PATH
  21.  
  22. set -e
  23. tmp=/tmp/rates.$$
  24. trap "rm -rf $tmp" 0 1 2 15
  25. mkdir $tmp $tmp/rates
  26. ratio=
  27. allfiles=
  28. /**/# Include relative rates in output?  Report only relative rates?
  29. case $1 in
  30. -r)
  31.     ratio=1
  32.     shift;
  33.     ;;
  34. -ro)
  35.     ratio=2
  36.     shift;
  37.     ;;
  38. esac
  39. /**/# Get either the provided label file, or construct one from the first
  40. /**/# x11perf output file given.
  41. case $1 in
  42. -l)    cp $2 $tmp/labels
  43.     shift; shift
  44.     ;;
  45. *)    awk '$2 == "reps" || $2 == "trep" { \
  46.         print $0; \
  47.         next; \
  48.         } \
  49.     ' $1 | sed 's/^.*: //' | uniq > $tmp/labels
  50.     ;;
  51. esac
  52. /**/# Go through all files, and create a corresponding rate file for each
  53. n=1
  54. for i
  55. do
  56. /**/# Get lines with average numbers, fill in any tests that may be missing
  57. /**/# then extract the rate field
  58.     base=`basename $i`
  59.     (echo "     $n  "; \
  60.      echo '--------'; \
  61.      awk '$2 == "reps" || $2 == "trep" {
  62.         line = $0;
  63.         next;
  64.         }
  65.         NF == 0 && line != "" {
  66.         print line;
  67.         line="";
  68.         next;
  69.         }
  70.      ' $i > $tmp/$base.avg; \
  71.      fillblnk $tmp/$base.avg $tmp/labels |
  72.      sed 's/( *\([0-9]*\)/(\1/'   |
  73.      awk '$2 == "reps" || $2 == "trep" {
  74.         n = substr($6,2,length($6)-7);
  75.         printf "%8s\n", n;
  76.         }
  77.     ') > $tmp/rates/$base
  78.     echo "$n: $base"
  79.     n=`expr $n + 1`
  80.     allfiles="$allfiles$base "
  81. done
  82. case x$ratio in
  83. x)
  84.     ratio=/bin/cat
  85.     ;;
  86. x1)
  87.     ratio="perfboth $n"
  88.     ;;
  89. *)
  90.     ratio="perfratio $n"
  91.     ;;
  92. esac
  93. echo ''
  94. (echo Operation; echo '---------'; cat $tmp/labels) | \
  95. (cd $tmp/rates; paste $allfiles -) | \
  96. sed 's/    /  /g' | $ratio
  97. rm -rf $tmp
  98.