[comp.windows.x] the correct shell script for Xstones

wjh@inf.rl.ac.uk (Bill Hewitt) (06/01/90)

I am in some confusion over the correct awk script to use to get xstone
ratings from the xbench software. The original script that I got with the
software is listed below :-

------------------------------------------------------------------------------
BEGIN                {
                       countedWeight["all"] = 0;
                       missedWeight["all"] = 0;
                       runtime["all"] = 0;

                       countedWeight["line"] = 0;
                       missedWeight["line"] = 0;
                       runtime["line"] = 0;

                       countedWeight["fill"] = 0;
                       missedWeight["fill"] = 0;
                       runtime["fill"] = 0;

                       countedWeight["blit"] = 0;
                       missedWeight["blit"] = 0;
                       runtime["blit"] = 0;

                       countedWeight["arc"] = 0;
                       missedWeight["arc"] = 0;
                       runtime["arc"] = 0;

                       countedWeight["text"] = 0;
                       missedWeight["text"] = 0;
                       runtime["text"] = 0;

                       countedWeight["complex"] = 0;
                       missedWeight["complex"] = 0;
                       runtime["complex"] = 0;

                       sunValue["line10"]           = 3456.00;
                       sunValue["line100"]          = 1745.45;
                       sunValue["line400"]          =  704.00;

                       sunValue["dline10"]          =  768.00;
                       sunValue["dline100"]         =  170.67;
                       sunValue["dline400"]         =   46.55;

                       sunValue["wline10"]          =   79.45;
                       sunValue["wline100"]         =   20.21;
                       sunValue["wline400"]         =    6.00;

                       sunValue["rects10"]          = 1722.18;
                       sunValue["rects100"]         = 1070.55;
                       sunValue["rects400"]         =  452.92;

                       sunValue["fillrects10"]      = 3916.80;
                       sunValue["fillrects100"]     = 1024.00;
                       sunValue["fillrects400"]     =  176.00;

                       sunValue["tiledrects10"]     = 2739.20;
                       sunValue["tiledrects100"]    =  329.14;
                       sunValue["tiledrects400"]    =   41.29;

                       sunValue["stippledrects10"]  = 1186.91;
                       sunValue["stippledrects100"] =  153.60;
                       sunValue["stippledrects400"] =   35.56;

                       sunValue["invrects10"]       = 3010.10;
                       sunValue["invrects100"]      =  859.91;
                       sunValue["invrects400"]      =  119.50;

                       sunValue["arcs10"]           =    4.82;
                       sunValue["arcs100"]          =    1.27;
                       sunValue["arcs400"]          =    0.55;

                       sunValue["filledarcs10"]     =   15.52;
                       sunValue["filledarcs100"]    =    5.45;
                       sunValue["filledarcs400"]    =    2.60;

                       sunValue["filledpoly100"]    =   90.33;

                       sunValue["screencopy10"]     =  158.50;
                       sunValue["screencopy100"]    =   83.57;
                       sunValue["screencopy400"]    =   17.76;

                       sunValue["scroll"]           =   26.59;

                       sunValue["bitmapcopy10"]     =  232.82;
                       sunValue["bitmapcopy100"]    =   52.76;
                       sunValue["bitmapcopy400"]    =    8.19;

                       sunValue["string"]           = 5009.45;

                       sunValue["complex1"]         =   15.30;
                     }

/ line10 /           { x = "line10";            w = 300;  g = "line"; }
/ line100 /          { x = "line100";           w = 400;  g = "line"; }
/ line400 /          { x = "line400";           w = 300;  g = "line"; }
/ dline10 /          { x = "dline10";           w =  50;  g = "line"; }
/ dline100 /         { x = "dline100";          w = 150;  g = "line"; }
/ dline400 /         { x = "dline400";          w = 100;  g = "line"; }
/ wline10 /          { x = "wline10";           w =  50;  g = "line"; }
/ wline100 /         { x = "wline100";          w = 100;  g = "line"; }
/ wline400 /         { x = "wline400";          w =  50;  g = "line"; }
/ rects10 /          { x = "rects10";           w = 150;  g = "line"; }
/ rects100 /         { x = "rects100";          w = 250;  g = "line"; }
/ rects400 /         { x = "rects400";          w = 150;  g = "line"; }
/ fillrects10 /      { x = "fillrects10";       w = 350;  g = "fill"; }
/ fillrects100 /     { x = "fillrects100";      w = 450;  g = "fill";  }
/ fillrects400 /     { x = "fillrects400";      w = 350;  g = "fill";  }
/ tiledrects10 /     { x = "tiledrects10";      w = 150;  g = "fill";  }
/ tiledrects100 /    { x = "tiledrects100";     w = 250;  g = "fill";  }
/ tiledrects400 /    { x = "tiledrects400";     w = 150;  g = "fill";  }
/ stippledrects10 /  { x = "stippledrects10";   w =  50;  g = "fill";  }
/ stippledrects100 / { x = "stippledrects100";  w = 100;  g = "fill";  }
/ stippledrects400 / { x = "stippledrects400";  w =  50;  g = "fill";  }
/ arcs10 /           { x = "arcs10";            w =  50;  g = "arc";  }
/ arcs100 /          { x = "arcs100";           w = 100;  g = "arc";  }
/ arcs400 /          { x = "arcs400";           w =  50;  g = "arc";  }
/ filledarcs10 /     { x = "filledarcs10";      w =  50;  g = "arc";  }
/ filledarcs100 /    { x = "filledarcs100";     w = 100;  g = "arc";  }
/ filledarcs400 /    { x = "filledarcs400";     w =  50;  g = "arc";  }
/ filledpoly100 /    { x = "filledpoly100";     w = 200;  g = "dummy"; }
/ invrects10 /       { x = "invrects10";        w = 100;  g = "blit"; }
/ invrects100 /      { x = "invrects100";       w = 150;  g = "blit"; }
/ invrects400 /      { x = "invrects400";       w = 100;  g = "blit"; }
/ screencopy10 /     { x = "screencopy10";      w =  50;  g = "blit"; }
/ screencopy100 /    { x = "screencopy100";     w = 150;  g = "blit"; }
/ screencopy400 /    { x = "screencopy400";     w = 100;  g = "blit"; }
/ scroll /           { x = "scroll";            w =1000;  g = "blit"; }
/ bitmapcopy10 /     { x = "bitmapcopy10";      w =  50;  g = "blit"; }
/ bitmapcopy100 /    { x = "bitmapcopy100";     w = 100;  g = "blit"; }
/ bitmapcopy400 /    { x = "bitmapcopy400";     w =  50;  g = "blit"; }
/ imagestring/       { x = "string";            w =3000;  g = "text"; }
/ complex1 /         { x = "complex1";          w = 800;  g = "complex"; }

/rate =/             {
                       if ( x != "dummy" ) {
                         ratio = $3 / sunValue[x];
                         runtime["all"] = runtime["all"] + w/ratio;
                         countedWeight["all"] = countedWeight["all"] + w;

                         runtime[g] = runtime[g] + w/ratio;
                         countedWeight[g] = countedWeight[g] + w;
                         x = "dummy"; w = 1
                       }
                     }

/NOT RUN/            {
                       if (x != "dummy") {
                         missedWeight["all"] = missedWeight["all"] + w;
                         missedWeight[g] = missedWeight[g] + w;
                         x = "dummy"; w = 1
                      }
                     }

END                  {
                       cw = countedWeight["line"];
                       mw = missedWeight["line"];
                       rt = runtime["line"];
                       allWeight = 10000;

                       if (cw == 0) {
                           print "TOTAL ? lineStones"
                       } else {
                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }
 
                           ratio = allWeight/rt;
                           stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f lineStones",text,stones);                           print t;
                       }

                       cw = countedWeight["fill"];
                       mw = missedWeight["fill"];
                       rt = runtime["fill"];

                       if (cw == 0) {
                           print "TOTAL ? fillStones"
                       } else {
                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }

                           ratio = allWeight/rt;
                           stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f fillStones",text,stones);                           print t;
                       }

                       cw = countedWeight["blit"];
                       mw = missedWeight["blit"];
                       rt = runtime["blit"];

                       if (cw == 0) {
                           print "TOTAL ? blitStones"
                       } else {
                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }

                           ratio = allWeight/rt;
                           stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f blitStones",text,stones);                           print t;
                       }

                       cw = countedWeight["arc"];
                       mw = missedWeight["arc"];
                       rt = runtime["arc"];

                       if (cw == 0) {
                           print "TOTAL ? arcStones"
                       } else {
                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }

                           ratio = allWeight/rt;
                            stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f arcStones",text,stones);
                           print t;
                       }

                       cw = countedWeight["text"];
                       mw = missedWeight["text"];
                       rt = runtime["text"];

                       if (cw == 0) {
                           print "TOTAL ? textStones"
                       } else {
                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }

                           ratio = allWeight/rt;
                           stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f textStones",text,stones);                           print t;
                       }

                       cw = countedWeight["complex"];
                       mw = missedWeight["complex"];
                       rt = runtime["complex"];

                       if (cw == 0) {
                           print "TOTAL ? complexStones"
                       } else {

                           rt = (rt*allWeight)/cw;
                           if (mw > 0) {
                               text = "expected ";
                           } else {
                               text = "";
                           }

                           ratio = allWeight/rt;
                           stones = int(allWeight * ratio);
                           t = sprintf("TOTAL %s %8.0f xStones",text,stones);
                           print t;
                       }
                     }
-------------------------------------------------------------------------------
 Is this still correct or has it been superceded ?

-- 
Bill Hewitt,                                 UUCP:  ..!mcvax!ukc!rlinf!wjh
Science & Engineering Research Council,      JANET:  wjh@uk.ac.rl.inf
Rutherford Appleton Laboratory,
Chilton, Didcot, 
Oxfordshire, OX11 0QX.             
U.K.                                           Tel: (0235) 44 5857       

	Someone get a message through to captain Snort.
	He'd better start assembling the boys from the fort !
	Keep Mrs Hunnyman right out of sight.
	There's gonna be a riot down in Trumpton tonight !

                       - Half Man Half Biscuit -