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