new-test-case.red 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. 5-Apr-83 07:45:58-MST,6502;000000000001
  2. Return-path: <@UTAH-CS:GRISS@HP-HULK>
  3. Received: from UTAH-CS by UTAH-20; Tue 5 Apr 83 07:43:05-MST
  4. Date: 5 Apr 1983 0633-PST
  5. From: GRISS@HP-HULK
  6. Subject: New-test-case.red
  7. Message-Id: <418401289.19796.hplabs@HP-VENUS>
  8. Received: by HP-VENUS via CHAOSNET; 5 Apr 1983 06:34:46-PST
  9. Received: by UTAH-CS.ARPA (3.320.5/3.7.6)
  10. id AA04736; 5 Apr 83 07:41:40 MST (Tue)
  11. To: kessler@HP-VENUS, griss@HP-VENUS
  12. % Tools to analyse the standard timing tests
  13. Fluid '(TestNames Fullnames Tests);
  14. imports '(mathlib);
  15. procedure readtest(name,fil);
  16. Begin scalar chan,body;
  17. chan := open(fil,'input);
  18. body:=channelread chan;
  19. put(name,'fullname,car body);
  20. body:=list(name) . cdr body;
  21. set(name,body);
  22. TestNames := name . TestNames;
  23. close chan;
  24. return body;
  25. End;
  26. procedure readalltests;
  27. Begin TestNames:=nil;
  28. Readtest('TestCray,"test-cray.tim");
  29. Readtest('Std20,"standard-20.tim");
  30. Readtest('Test20,"test-20.tim");
  31. Readtest('Ext20,"extended-20.tim");
  32. Readtest('TestExt20,"extended-test-20.tim");
  33. Readtest('Fasthp9836,"16mhz-hp9836.tim");
  34. Readtest('Std780,"standard-vax-780.tim");
  35. Readtest('Fast780,"fast-780.tim");
  36. Readtest('Franz780,"Franz-780.tim");
  37. Readtest('Std750,"standard-vax-750.tim");
  38. Readtest('Franz750,"Franz-750.tim");
  39. Readtest('Stdhp9836,"standard-hp9836.tim");
  40. Readtest('StdApollo,"standard-Apollo.tim");
  41. % Non PSL
  42. Readtest('LM2,"LM2-hp.tim");
  43. Readtest('BlkDolphin,"Block-dolphin.tim");
  44. Print Testnames;
  45. Tests :=Evlis TestNames;
  46. return TestNames;
  47. End;
  48. Procedure Show body;
  49. Begin scalar HDR,fn;
  50. HDR:=car body;
  51. If (fn:=Get(car HDR,'ShowFn)) then return Apply(fn,list body);
  52. % Default Case
  53. Terpri();
  54. prin2l car body; % Header
  55. Terpri();
  56. While (body:=cdr body) do
  57. printf("%w%t%w%n",trimblanks caar body,Tab!*,NiceNum cdar body);
  58. End;
  59. procedure Lookup(Body,Facet);
  60. Begin scalar value;
  61. If pairp(value:=assoc(Facet,cdr Body)) then return cdr value;
  62. return 0.0;
  63. End;
  64. procedure ShowTotal Body;
  65. Begin scalar Hdr;
  66. Hdr:=car Body;
  67. printf("%p: %tTot%w, avg%w, dev %w , %w tests%n",
  68. Hdr, 10, Nicenum Lookup(Body,'total),
  69. nicenum Lookup(Body,'Average),
  70. nicenum Lookup(Body,'Deviation),
  71. Nicenum Lookup(Body,'Number));
  72. End;
  73. put('total, 'showfn,' ShowTotal);
  74. Procedure Total body;
  75. Begin scalar Hdr,knt,tot,avg,dev,b;
  76. Knt:=0;
  77. Tot:=0;
  78. Dev:=0;
  79. Hdr:=car Body;
  80. While body:=cdr body do
  81. <<knt:=knt+1;
  82. b:=cdar body;
  83. tot:=tot + b;
  84. dev := b*b+dev;
  85. >>;
  86. Avg:=float(Tot)/knt;
  87. dev:=float(dev)/knt;
  88. dev:=dev-(avg*avg);
  89. dev:=sqrt(dev);
  90. b:=list('Total . Hdr,
  91. 'Total . tot,
  92. 'Average . avg,
  93. 'Deviation . dev,
  94. 'Number .knt);
  95. return b
  96. End;
  97. procedure Ratio(Body1,Body2);
  98. % Divide elements of Body1 by Elements of Body2
  99. Begin scalar Hdr1,Hdr2,Rat,b1,b2,r,knt,avg,dev;
  100. Hdr1:=car body1; Hdr2:= car Body2;
  101. Body1:=cdr body1; Body2:=cdr Body2;
  102. If length body1 neq length body2 Then return "Length mismatch";
  103. knt:=0; avg:=0; dev:=0;
  104. While Body1 do
  105. <<b1:=cdar body1; c:= caar body1; body1:=cdr body1;
  106. b2:=cdar body2; body2:=cdr body2;
  107. r:=float(b1)/b2;
  108. avg:=r + avg;
  109. dev:=r*r +dev;
  110. knt:=knt+1;
  111. rat := (c . r) . rat;
  112. >>;
  113. avg:=float(avg)/knt;
  114. dev:=float(dev)/knt;
  115. dev:=dev-(avg*avg);
  116. dev:=sqrt dev;
  117. rat := list('ratio,hdr1,hdr2) . reverse rat;
  118. return rat;
  119. end;
  120. procedure ratio20 body;
  121. Ratio(Body,std20);
  122. procedure Ratio780 body;
  123. Ratio(Body,std780);
  124. procedure Ratio750 body;
  125. Ratio(body,std780);
  126. procedure Ratiohp9836 body;
  127. Ratio(body,stdhp9836);
  128. procedure MapTest(Fns,TestList);
  129. % Apply each Fn in Fns to each test in list
  130. for each Test in TestList
  131. collect applyFns(Reverse FnS,list Test);
  132. Procedure ApplyFns(Fns,Args);
  133. If Not Pairp Fns then Car Args % Pass back
  134. else ApplyFns(cdr Fns, List Apply(car Fns,Args));
  135. procedure MapBody(Fns,Body);
  136. % Apply series of Fns to each Element in Body of test
  137. Begin
  138. For each Fn in Fns do
  139. Body:=(Fn . car Body) . MapBody1(Fn, cdr body);
  140. return Body;
  141. End;
  142. procedure MapBody1(Fn,Body);
  143. If Null Body then NIL
  144. else ( caar body . Apply(Fn,list cdar body)) . MapBody1 (fn,cdr Body);
  145. %standard Maps
  146. Procedure Invert Body;
  147. MapBody('(Inverted), Body);
  148. Procedure Inverted x;
  149. 1.0/x;
  150. procedure Logarithm Body;
  151. MapBody('(LOG),Body);
  152. procedure summary();
  153. <<readalltests();
  154. wrs open("summary.tim",'output);
  155. printf("%n%n SUMMARY TESTS on %w%n%n",DATE());
  156. mapall();
  157. close wrs nil>>;
  158. Procedure MapAll;
  159. Begin scalar t20;
  160. T20:=Total Std20;
  161. Printf "%n Total Times %n";
  162. MapTest('(show total),Tests);
  163. Printf "%n Ratio of Total Times to STD20%n";
  164. for each test in Tests do
  165. showtotal ratio(Total test,t20);
  166. Printf "%n Average Each test Ratios to STD20%n";
  167. MapTest('(show total ratio20),Tests);
  168. PrintF "%n 68000 Total times%n";
  169. showtotal ratio(total StdHp9836,total FastHp9836);
  170. showtotal ratio(total StdApollo,total StdHp9836);
  171. PrintF "%n 68000 average ratios%n";
  172. show total ratio(StdHp9836,FastHp9836);
  173. show total ratio(StdApollo,StdHp9836);
  174. End;
  175. procedure MapFileAll(fil,Fns);
  176. Begin scalar chan;
  177. chan:=open(fil,'output);
  178. wrs chan;
  179. MapTest(Fns,Tests);
  180. wrs nil;
  181. close chan;
  182. End;
  183. % Nicer printing
  184. procedure MakePowers(Base,M);
  185. Begin scalar V;
  186. V:=Mkvect M;
  187. v[0]:=1;
  188. for i:=1:M do V[i]:=Base* V[i-1];
  189. return V;
  190. End;
  191. Tens!* := MakePowers(10,10);
  192. Procedure FLTRND(N,fld);
  193. If floatp N then Fix(FLD*N+.5)/float(fld) else N;
  194. Procedure NiceNum N;
  195. PadNM(N,nice!*,Fld!*);
  196. FLD!*:=3;
  197. Nice!*:=7;
  198. Tab!*:=30;
  199. Procedure PADNM(Num,n,m);
  200. % LeftPAD number in Field of N;
  201. Begin scalar m1,m2,FixPart;
  202. FixPart :=Fix Num;
  203. m1:=BLDMSG("%p",FIXPART);
  204. N:=N-Size(m1)-1; % Number of Blanks
  205. if n>0 then m1:=Concat(MkString(n-1,32),m1);
  206. if m>0 then <<NUM := NUM-Fixpart;
  207. m2:=BLDMSG("%p",FIX(num*Tens!*[m]+0.5));
  208. M:=M-size(m2)-1; % Number of 0s
  209. if m>0 then m2:=Concat(MkString(m-1,48),m2);
  210. m1:=Concat(m1,concat(".",m2))>>;
  211. return m1;
  212. End;
  213. procedure TrimBlanks S;
  214. Begin scalar N;
  215. if not stringp s then return s;
  216. n:=Size s;
  217. While n>0 and (s[n]=char BLANK or s[n] = char TAB) do n:=n-1;
  218. return sub(s,0,n);
  219. End;
  220. End;
  221. -------