home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume9 / tbench / oprint < prev    next >
Text File  |  1989-11-12  |  2KB  |  82 lines

  1. #!/bin/sh
  2. #
  3. ####################################################
  4. #     This software released to the public domain  #
  5. #     without restrictions of any kind.            #
  6. ####################################################
  7. #
  8. #    @(#)oprint    3.1 9/22/89
  9.  
  10. (    sed -ne '
  11.         /^#/p
  12.         s/exta/19200/
  13.         s/extb/38400/
  14.         s/.*TEST.*tty=\([^,]*\).*baud=\([^,]*\).*mode=\([^,]*\).*/TEST \1 \2 \3/p
  15.         s/.*OUTPUT.*OUT.*cps=\([^,]*\).*real=\([^,]*\).*user=\([^,]*\).*sys=\([^,]*\).*/CAL \1 \2 \3 \4/p
  16.         s/.*dev.*OUT.*cps=\([^,]*\).*real=\([^,]*\).*user=\([^,]*\).*sys=\([^,]*\).*/OUT \1 \2 \3 \4/p
  17.         s/.*TIME.*process=\([^,]*\).*interrupt=\([^,]*\).*total=\([^,]*\).*/TIME \1 \2 \3/p
  18.         ' $* \
  19. |    tee junk \
  20. |    awk '
  21.         BEGIN {
  22.             tty = 0 ; n = 0 ;
  23.             process = 0 ; interrupt = 0 ; total = 0 ;
  24.             cps = 0 ; real = 0 ;
  25.             usercost = 42.2 / 85470 ;
  26.         }
  27.  
  28.         /^\#/ { print ; next }
  29.  
  30.         /^TIME/ {
  31.             process += $2 ; interrupt += $3 ; total += $4 ;
  32.             }
  33.  
  34.         /^CAL/ {
  35.             usercost = $4 / $2 ;
  36.         }
  37.  
  38.         /^OUT/ {
  39.             cps += $2 ; real += $3 ;
  40.             n += 1 ;
  41.         }
  42.  
  43.         /^TEST/ {
  44.             if (tty == 0) {
  45.                 printf("\n\n") ;
  46.                 printf(" ports     baud      mode        cps      real      %%sys     %%host\n") ;
  47.                 printf(" -----    ------    ------      -----    ------    -----     ----\n") ;
  48.             }
  49.  
  50.             if (n != 0) {
  51.                 if (n != tty) {
  52.                     print "**** Following results suspect:" ;
  53.                 }
  54.  
  55.                 cpu = total - cps * usercost ;
  56.                 printf("%5d %9s %10s   %8.1f %9.1f %8.1f %8.2f\n", \
  57.                     tty, baud, mode, cps / n, real / n, \
  58.                     cpu, 1000 * cpu / cps) ;
  59.             }
  60.  
  61.             lastbaud=baud ; lastmode=mode ;
  62.             tty = $2 ; baud = $3 ; mode = $4 ;
  63.  
  64.             if (n != 0 && (baud != lastbaud || lastmode != mode)) {
  65.                 printf("\n") ;
  66.             }
  67.  
  68.             n = 0 ;
  69.             process = 0 ; interrupt = 0 ; total = 0 ;
  70.             cps = 0 ; real = 0 ;
  71.         }
  72.         END {
  73.             if (n != 0) {
  74.                 cpu = total - cps * usercost ;
  75.                 printf("%5d %9s %10s   %8.1f %9.1f %8.1f %8.2f\n", \
  76.                     tty, baud, mode, cps/n, real/n, \
  77.                     cpu, 1000 * cpu / cps) ;
  78.             }
  79.         }
  80.         '
  81. )
  82.