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

  1. ###############################################################################
  2. #  The BYTE UNIX Benchmarks - Release 2
  3. #          Module: time.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. /^cctest.c$/    { next }
  18. /^[Rr]eal/ {
  19.     if (!fail) {
  20.         l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  21.         t=m*60+s; real+=t; r2+=t*t; ok++;
  22.         if (t) {r_product += log(t);}
  23.     }
  24.     iter++; fail=0; next }
  25. /^[Uu]ser/ {
  26.     l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  27.     t=m*60+s; user+=t; cpu=t; u2+=t*t;
  28.     if (t) { u_product += log(t);}
  29.     next; }
  30. /^[Ss]ys/ {
  31.     l=length($2); m=substr($2,1,l-5); s=substr($2,l-3,4)
  32.     t=m*60+s; sys+=t; s2+=t*t; 
  33.     if (t) { s_product += log(t);}
  34.     next; }
  35. /^$/    { next }
  36.     { print "** Iteration ",iter+1," Failed: ",$0; fail=1 }
  37. END {
  38.     if (fail) iter++
  39.     if (ok != iter) {
  40.         printf "For %d successful iterations from %d attempts ...\n",ok,iter
  41.         iter=ok;
  42.     }
  43.     if (ok > 0) {
  44.         printf "                       Arithmetric        Geometric         Variance\n";
  45.         printf "                              Mean             Mean         (%d tests)\n",ok
  46.         printf "User Time (secs):        %9.2f        %9.2f         ",user/ok,exp(u_product/ok);
  47.         if (ok > 1) printf "%9.2f\n",(u2-user*user/ok)/(ok-1);
  48.         else printf "n/a\n"
  49.         printf "System Time (secs):      %9.2f        %9.2f         ",sys/ok,exp(s_product/ok);
  50.         if (ok > 1) printf "%9.2f\n",(s2-sys*sys/ok)/(ok-1);
  51.         else printf "n/a\n"
  52.         printf "Real Time (secs):        %9.2f        %9.2f         ",real/ok,exp(r_product/ok);
  53.         if (ok > 1) printf "%9.2f\n",(r2-real*real/ok)/(ok-1);
  54.         else printf "n/a\n"
  55.     } else {
  56.         print "-- no measured results --"
  57.     }
  58.     }
  59.