home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / byteunix.lzh / byte.1 / BSDtime.awk < prev    next >
Text File  |  1990-05-11  |  2KB  |  53 lines

  1. ###############################################################################
  2. #  The BYTE UNIX Benchmarks - Release 2
  3. #          Module: BSDtime.awk   SID: 2.3 4/17/90 16:45:40
  4. #          
  5. ###############################################################################
  6. # Bug reports, patches, comments, suggestions should be sent to:
  7. #
  8. #    Ben Smith or Rick Grehan at BYTE Magazine
  9. #    ben@bytepb.UUCP    rick_g@bytepb.UUCP
  10. #
  11. ###############################################################################
  12. #  Modification Log:
  13. #     added geometric mean 8/6/89 -ben
  14. #
  15. ###############################################################################
  16. BEGIN   { r_product = 0.0000; s_product = 0.0000; u_product = 0.0000; }
  17. /real/    { if (!fail) {
  18.         real+=$1;
  19.         r2+=$1*$1;
  20.         user+=$3;
  21.         u2 += $3*$3;
  22.         sys+=$5;
  23.         s2 += $5*$5;
  24.         if($1) { r_product += log($1); }
  25.         if($1) { u_product += log($3); }
  26.         if($1) { s_product += log($5); }
  27.         ok++
  28.       }
  29.           iter++; fail=0; next;
  30.     }
  31.     { print "** Iteration ",iter+1," Failed: ",$0; fail=1 }
  32. END {
  33.     if (fail) iter++;
  34.     if (ok != iter) {
  35.         printf "For %d successful iterations from %d attempts ...\n",ok,iter
  36.         iter=ok
  37.     }
  38.     if (ok > 0) {
  39.         printf "                       Arithmetric        Geometric         Variance\n";
  40.         printf "                              Mean             Mean         (%d tests)\n",ok
  41.         printf "User Time (secs):        %9.2f        %9.2f         ",user/ok,exp(u_product/ok);
  42.         if (ok > 1) printf "%9.2f\n",(u2-user*user/ok)/(ok-1);
  43.         else printf "n/a\n"
  44.         printf "System Time (secs):      %9.2f        %9.2f         ",sys/ok,exp(s_product/ok);
  45.         if (ok > 1) printf "%9.2f\n",(s2-sys*sys/ok)/(ok-1);
  46.         else printf "n/a\n"
  47.         printf "Real Time (secs):        %9.2f        %9.2f         ",real/ok,exp(r_product/ok);
  48.         if (ok > 1) printf "%9.2f\n",(r2-real*real/ok)/(ok-1);
  49.         else printf "n/a\n"
  50.             }
  51.     else printf "-- no measured results --\n "
  52.     }
  53.