home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- ####################################################
- # This software released to the public domain #
- # without restrictions of any kind. #
- ####################################################
- #
- # @(#)iprint 3.1 9/22/89
-
- ( sed -ne '
- /^#/p
- s/exta/19200/
- s/extb/38400/
- s/.*TEST.*tty=\([^,]*\).*baud=\([^,]*\).*mode=\([^,]*\).*flow=\([^,]*\).*/TEST \1 \2 \3 \4/p
- s/.*TIME.*process=\([^,]*\).*interrupt=\([^,]*\).*total=\([^,]*\).*/TIME \1 \2 \3/p
- s/.*INPUT.*IN.*cps=\([^,]*\).*real=\([^,]*\).*user=\([^,]*\).*sys=\([^,]*\).*errs=\([^,]*\).*stray=\([^,]*\).*/CAL \1 \2 \3 \4 \5 \6/p
- s/.*dev.*IN.*cps=\([^,]*\).*real=\([^,]*\).*user=\([^,]*\).*sys=\([^,]*\).*errs=\([^,]*\).*stray=\([^,]*\).*/IN \1 \2 \3 \4 \5 \6/p
- ' $* \
- | awk '
- BEGIN {
- tty = 0 ; n = 0 ;
- cps = 0 ; ; errs = 0 ; stray = 0 ;
- process = 0 ; interrupt = 0 ; total = 0 ;
- usercost = 48.2 / 85499 ;
- }
-
- /^#/ { print ; next }
-
- /^TIME/ {
- process += $2 ; interrupt += $3 ; total += $4 ;
- }
-
- /^CAL/ {
- usercost = $4 / $2 ;
- }
-
- /^IN/ {
- n += 1 ;
- cps += $2 ; errs += $6 ; stray += $7 ;
- }
-
- /^TEST/ {
- if (n != 0) {
- if (n != tty) {
- print "**** Following results suspect:" ;
- }
-
- cpu = total - cps * usercost ;
- printf("%5d %9s %10s %8s %8.1f %8.1f %10.2f %8.2f\n", \
- tty, baud, mode, flow, cps/n, errs, \
- cpu, 1000*cpu/cps) ;
- }
-
- n = 0 ;
- cps = 0 ; errs = 0 ; stray = 0 ;
- process = 0 ; interrupt = 0 ; total = 0 ;
-
- if (tty == 0) {
- printf("\n\n") ;
- printf(" ports baud mode flow cps errs %%sys %%host\n") ;
- printf(" ----- ------ ------ ------ ----- ------ ------- ------\n") ;
- }
-
- lastbaud = baud ; lastmode = mode ; lastflow = flow ;
- tty = $2 ; baud = $3 ; mode = $4 ; flow = $5 ;
-
- if (baud != lastbaud || lastmode != mode || lastflow != flow) {
- printf("\n") ;
- }
- }
-
- /^\#/ { print }
-
- END {
- if (n != 0) {
- cpu = total - cps * usercost ;
- printf("%5d %9s %10s %8s %8.1f %8.1f %10.2f %8.2f\n", \
- tty, baud, mode, flow, cps/n, errs, \
- cpu, 1000*cpu/cps) ;
- }
- }
- '
- )
-