[comp.windows.x] awk script for computing xstones

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

I m rather confused ! I currently have 2 different awk scripts for computing
xstones. The 2 scripts have different baseline figures and a slightly different
method for the calculation. Does anyone have the difinitive answer to the question "Which is the correct awk script for producing xstones ?"

Any help would be much appreciated !!!




-- 
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 -

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (06/07/90)

    Does anyone have the difinitive answer to the question
    "Which is the correct awk script for producing xstones ?"

I've seen so many blind quotations of bogusly-computed xstones numbers lately,
I'd say the definitive answer is to stop depending on xstones entirely.  Or
at least don't depend on the "averaged" numbers, just look at the raw
numbers and make your own comparisons.

The "original" awk script was clearly wrong.  For the record, here's the
xstones.awk we have here (which I believe came from someone at Tektronix).
I wouldn't call it "definitive" since we claim no control over xbench and
don't endorse it, but it's better than the original:

BEGIN                {
		       countedWeight["x"] = 0;
		       missedWeight["x"] = 0;
		       runtime["x"] = 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"]           = 2616;
		       sunValue["line100"]          = 1630.80;
		       sunValue["line400"]          =  643.50;

		       sunValue["dline10"]          =  818.73;
		       sunValue["dline100"]         =  171.60;
		       sunValue["dline400"]         =   49.62;

		       sunValue["wline10"]          =   78;
		       sunValue["wline100"]         =   19.09;
		       sunValue["wline400"]         =    6;

		       sunValue["rects10"]          = 1115.27;
		       sunValue["rects100"]         =  796.73;
		       sunValue["rects400"]         =  414;

		       sunValue["fillrects10"]      = 1244.60;
		       sunValue["fillrects100"]     =  693.80;
		       sunValue["fillrects400"]     =  157.08;

		       sunValue["tiledrects10"]     = 1387.20;
		       sunValue["tiledrects100"]    =  323.17;
		       sunValue["tiledrects400"]    =   48.12;

		       sunValue["stippledrects10"]  =  834.73;
		       sunValue["stippledrects100"] =  153.17;
		       sunValue["stippledrects400"] =   35.57;

		       sunValue["invrects10"]       = 3440.09;
		       sunValue["invrects100"]      =  938.27;
		       sunValue["invrects400"]      =  134.44;

		       sunValue["arcs10"]           =    5.43;
		       sunValue["arcs100"]          =    1.23;
		       sunValue["arcs400"]          =    0.53;

		       sunValue["filledarcs10"]     =   25.26;
		       sunValue["filledarcs100"]    =    6.0;
		       sunValue["filledarcs400"]    =    2.73;

		       sunValue["filledpoly100"]    =   99.83;

		       sunValue["screencopy10"]     =  225.82;
		       sunValue["screencopy100"]    =   94.29;
		       sunValue["screencopy400"]    =   17.76;

		       sunValue["scroll"]           =   68.20;

		       sunValue["bitmapcopy10"]     =  302.64;
		       sunValue["bitmapcopy100"]    =   68.33;
		       sunValue["bitmapcopy400"]    =   10.69;

		       sunValue["string"]           = 5635.64;

		       sunValue["complex1"]         =   18.6;
		
		       resultnames[0] = "line";
		       resultnames[1] = "fill";
		       resultnames[2] = "blit";
		       resultnames[3] = "arc";
		       resultnames[4] = "text";
		       resultnames[5] = "complex";
		       resultnames[6] = "x";
		       resultcount = 7;
		     }

/ 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" ) {
#			 printf ("%s value is %8.0f sun is %8.0f\n", x, $3, sunValue[x]);
#			 printf ("ratio %8.4f weight %8.0f\n", ratio, w);
#			 printf ("runtime[x] %8.0f countedWeight[x] %8.0f\n",runtime["x"], countedWeight["x"]);
#			 printf ("runtime[g] %8.0f countedWeight[g] %8.0f\n",runtime[g], countedWeight[g]);
			 ratio = $3 / sunValue[x];
			 runtime["x"] = runtime["x"] + w*ratio;
			 countedWeight["x"] = countedWeight["x"] + w;

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

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

END                  {
		       allWeight = 10000;
		       for (result = 0; result < resultcount; result++) {
			   resultname = resultnames[result];
			   cw = countedWeight[resultname];
			   mw = missedWeight[resultname];
			   rt = runtime[resultname];

			   if (cw == 0) {
				printf "TOTAL ? %sStones\n", resultname;
			   } else {
				if (mw > 0) {
				    text = "expected ";
				} else {
				    text = "";
				}

				ratio = rt / cw;
				stones = int(allWeight * ratio);
				printf ("TOTAL %s %8.0f %sStones\n", text, stones, resultname);
			    }
		       }

		     }