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

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