sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\bench\t_whet.cpp
|
sl@0
|
15 |
// Whetstone Benchmarks
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32math.h>
|
sl@0
|
21 |
#include <e32std.h>
|
sl@0
|
22 |
#include <e32std_private.h>
|
sl@0
|
23 |
#include <f32file.h>
|
sl@0
|
24 |
#include <e32svr.h>
|
sl@0
|
25 |
#include <e32test.h>
|
sl@0
|
26 |
#include <hal.h>
|
sl@0
|
27 |
#include "../server/t_server.h"
|
sl@0
|
28 |
|
sl@0
|
29 |
const TInt KSections=9;
|
sl@0
|
30 |
|
sl@0
|
31 |
LOCAL_D TReal64 loop_time[KSections];
|
sl@0
|
32 |
LOCAL_D TReal64 loop_mops[KSections];
|
sl@0
|
33 |
LOCAL_D TReal64 loop_mflops[KSections];
|
sl@0
|
34 |
LOCAL_D TReal64 TimeUsed;
|
sl@0
|
35 |
LOCAL_D TReal64 mwips;
|
sl@0
|
36 |
LOCAL_D TBufC<50> headings[KSections];
|
sl@0
|
37 |
LOCAL_D TReal64 Check;
|
sl@0
|
38 |
LOCAL_D TReal64 results[KSections];
|
sl@0
|
39 |
|
sl@0
|
40 |
LOCAL_D TBuf<0x100> buf;
|
sl@0
|
41 |
LOCAL_D TBuf8<0x100> buf8;
|
sl@0
|
42 |
LOCAL_D const TFileName pathName = _L("C:\\E32-MATH\\");
|
sl@0
|
43 |
#ifdef T_WHET_WITH_VFP
|
sl@0
|
44 |
LOCAL_D const TFileName fileName = _L("WHETVFP.RES");
|
sl@0
|
45 |
#else
|
sl@0
|
46 |
LOCAL_D const TFileName fileName = _L("WHET.RES");
|
sl@0
|
47 |
#endif
|
sl@0
|
48 |
LOCAL_D RFile outfile;
|
sl@0
|
49 |
|
sl@0
|
50 |
#ifdef T_WHET_WITH_VFP
|
sl@0
|
51 |
GLDEF_D RTest test(_L("TReal64 C/C++ Whetstone Benchmark with VFP"));
|
sl@0
|
52 |
#else
|
sl@0
|
53 |
GLDEF_D RTest test(_L("TReal64 C/C++ Whetstone Benchmark"));
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
|
sl@0
|
56 |
LOCAL_C void appendString(const TDesC& aString)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
|
sl@0
|
59 |
buf=_L("");
|
sl@0
|
60 |
buf.AppendFormat(_L("%S\n"),&aString);
|
sl@0
|
61 |
buf8.Copy(buf); // Unicode
|
sl@0
|
62 |
outfile.Write(buf8);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
LOCAL_C void pa(TReal64* e,TReal64 t,TReal64 t2)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
|
sl@0
|
68 |
TInt j;
|
sl@0
|
69 |
for (j=0;j<6;j++)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
e[0]=(e[0]+e[1]+e[2]-e[3])*t;
|
sl@0
|
72 |
e[1]=(e[0]+e[1]-e[2]+e[3])*t;
|
sl@0
|
73 |
e[2]=(e[0]-e[1]+e[2]+e[3])*t;
|
sl@0
|
74 |
e[3]=(-e[0]+e[1]+e[2]+e[3])/t2;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
LOCAL_C void po(TReal64* e1,TInt j,TInt k,TInt l)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
|
sl@0
|
81 |
e1[j]=e1[k];
|
sl@0
|
82 |
e1[k]=e1[l];
|
sl@0
|
83 |
e1[l]=e1[j];
|
sl@0
|
84 |
}
|
sl@0
|
85 |
|
sl@0
|
86 |
LOCAL_C void p3(TReal64 *x,TReal64 *y,TReal64 *z,TReal64 t,TReal64 t1,TReal64 t2)
|
sl@0
|
87 |
{
|
sl@0
|
88 |
|
sl@0
|
89 |
*x=*y;
|
sl@0
|
90 |
*y=*z;
|
sl@0
|
91 |
*x=t*(*x+*y);
|
sl@0
|
92 |
*y=t1*(*x+*y);
|
sl@0
|
93 |
*z=(*x+*y)/t2;
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
LOCAL_C void pout(const TDesC& aTitle,TReal64 aOps,TInt aType,TReal64 aChecknum,TReal64 aTime,
|
sl@0
|
97 |
TInt aCalibrate,TInt aSection)
|
sl@0
|
98 |
{
|
sl@0
|
99 |
|
sl@0
|
100 |
TReal64 mops,mflops;
|
sl@0
|
101 |
|
sl@0
|
102 |
Check+=aChecknum;
|
sl@0
|
103 |
loop_time[aSection]=aTime;
|
sl@0
|
104 |
headings[aSection]=aTitle;
|
sl@0
|
105 |
TimeUsed+=aTime;
|
sl@0
|
106 |
|
sl@0
|
107 |
if (aCalibrate==1)
|
sl@0
|
108 |
results[aSection]=aChecknum;
|
sl@0
|
109 |
|
sl@0
|
110 |
if (aCalibrate==0)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
test.Printf(_L("%- 20S%- 18g"),&headings[aSection],results[aSection]);
|
sl@0
|
113 |
|
sl@0
|
114 |
if (aType==1)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
if (aTime>0)
|
sl@0
|
117 |
mflops=aOps/(1E+6*aTime);
|
sl@0
|
118 |
else
|
sl@0
|
119 |
mflops=0.0;
|
sl@0
|
120 |
|
sl@0
|
121 |
loop_mops[aSection]=99999.0;
|
sl@0
|
122 |
loop_mflops[aSection]=mflops;
|
sl@0
|
123 |
test.Printf(_L("%- 34g%- 7g\n"),loop_mflops[aSection],loop_time[aSection]);
|
sl@0
|
124 |
}
|
sl@0
|
125 |
else
|
sl@0
|
126 |
{
|
sl@0
|
127 |
if (aTime>0)
|
sl@0
|
128 |
mops=aOps/(1E+6*aTime);
|
sl@0
|
129 |
else
|
sl@0
|
130 |
mops=0.0;
|
sl@0
|
131 |
|
sl@0
|
132 |
loop_mops[aSection]=mops;
|
sl@0
|
133 |
loop_mflops[aSection]=0.0;
|
sl@0
|
134 |
test.Printf(_L(" %- 17g%- 7g\n"),loop_mops[aSection],loop_time[aSection]);
|
sl@0
|
135 |
}
|
sl@0
|
136 |
}
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
LOCAL_C void whetstones(TInt xtra,TInt x100,TInt calibrate)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
|
sl@0
|
142 |
TTime timea,timeb;
|
sl@0
|
143 |
TReal64 t=0.49999975;
|
sl@0
|
144 |
const TReal64 t0=t;
|
sl@0
|
145 |
|
sl@0
|
146 |
TReal64 t1=0.50000025;
|
sl@0
|
147 |
TReal64 t2=2.0;
|
sl@0
|
148 |
|
sl@0
|
149 |
Check=0.0;
|
sl@0
|
150 |
|
sl@0
|
151 |
TInt n1,n2,n3,n4,n5,n6,n7,n8,n1mult;
|
sl@0
|
152 |
n1 = 12*x100;
|
sl@0
|
153 |
n2 = 14*x100;
|
sl@0
|
154 |
n3 = 345*x100;
|
sl@0
|
155 |
n4 = 210*x100;
|
sl@0
|
156 |
n5 = 32*x100;
|
sl@0
|
157 |
n6 = 899*x100;
|
sl@0
|
158 |
n7 = 616*x100;
|
sl@0
|
159 |
n8 = 93*x100;
|
sl@0
|
160 |
n1mult = 10;
|
sl@0
|
161 |
|
sl@0
|
162 |
// Section 1, Array elements
|
sl@0
|
163 |
TReal64 e1[] =
|
sl@0
|
164 |
{1.0,-1.0,-1.0,-1.0};
|
sl@0
|
165 |
TInt i,ix;
|
sl@0
|
166 |
|
sl@0
|
167 |
timea.HomeTime();
|
sl@0
|
168 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
for(i=0; i<n1*n1mult; i++)
|
sl@0
|
171 |
{
|
sl@0
|
172 |
e1[0]=(e1[0]+e1[1]+e1[2]-e1[3])*t;
|
sl@0
|
173 |
e1[1]=(e1[0]+e1[1]-e1[2]+e1[3])*t;
|
sl@0
|
174 |
e1[2]=(e1[0]-e1[1]+e1[2]+e1[3])*t;
|
sl@0
|
175 |
e1[3]=(-e1[0]+e1[1]+e1[2]+e1[3])*t;
|
sl@0
|
176 |
}
|
sl@0
|
177 |
t=1.0-t;
|
sl@0
|
178 |
}
|
sl@0
|
179 |
t=t0;
|
sl@0
|
180 |
timeb.HomeTime();
|
sl@0
|
181 |
TReal64 time=I64REAL(timeb.Int64()-timea.Int64())/(TReal64(n1mult)*1E+6);
|
sl@0
|
182 |
|
sl@0
|
183 |
pout(_L("N1 floating point "),TReal64(n1*16)*TReal64(xtra),1,e1[3],time,calibrate,1);
|
sl@0
|
184 |
|
sl@0
|
185 |
// Section 2, Array as parameter
|
sl@0
|
186 |
|
sl@0
|
187 |
timea.HomeTime();
|
sl@0
|
188 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
for(i=0; i<n2; i++)
|
sl@0
|
191 |
pa(e1,t,t2);
|
sl@0
|
192 |
t=1.0-t;
|
sl@0
|
193 |
}
|
sl@0
|
194 |
t= t0;
|
sl@0
|
195 |
timeb.HomeTime();
|
sl@0
|
196 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
197 |
|
sl@0
|
198 |
pout(_L("N2 floating point "),TReal64(n2*96)*TReal64(xtra),1,e1[3],time,calibrate,2);
|
sl@0
|
199 |
|
sl@0
|
200 |
// Section 3, Conditional jumps
|
sl@0
|
201 |
TInt j=1;
|
sl@0
|
202 |
|
sl@0
|
203 |
timea.HomeTime();
|
sl@0
|
204 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
for(i=0; i<n3; i++)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
if(j==1)
|
sl@0
|
209 |
j = 2;
|
sl@0
|
210 |
else
|
sl@0
|
211 |
j = 3;
|
sl@0
|
212 |
if(j>2)
|
sl@0
|
213 |
j = 0;
|
sl@0
|
214 |
else
|
sl@0
|
215 |
j = 1;
|
sl@0
|
216 |
if(j<1)
|
sl@0
|
217 |
j = 1;
|
sl@0
|
218 |
else
|
sl@0
|
219 |
j = 0;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
}
|
sl@0
|
222 |
timeb.HomeTime();
|
sl@0
|
223 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
224 |
|
sl@0
|
225 |
pout(_L("N3 if then else "),TReal64(n3*3)*TReal64(xtra),2,TReal64(j),time,calibrate,3);
|
sl@0
|
226 |
|
sl@0
|
227 |
// Section 4, Integer arithmetic
|
sl@0
|
228 |
j=1;
|
sl@0
|
229 |
TInt k=2;
|
sl@0
|
230 |
TInt l=3;
|
sl@0
|
231 |
|
sl@0
|
232 |
timea.HomeTime();
|
sl@0
|
233 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
234 |
{
|
sl@0
|
235 |
for(i=0; i<n4; i++)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
j=j*(k-j)*(l-k);
|
sl@0
|
238 |
k=l*k-(l-j)*k;
|
sl@0
|
239 |
l=(l-k)*(k+j);
|
sl@0
|
240 |
e1[l-2]=j+k+l;
|
sl@0
|
241 |
e1[k-2]=j*k*l;
|
sl@0
|
242 |
}
|
sl@0
|
243 |
}
|
sl@0
|
244 |
timeb.HomeTime();
|
sl@0
|
245 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
246 |
|
sl@0
|
247 |
TReal64 x=e1[0]+e1[1];
|
sl@0
|
248 |
|
sl@0
|
249 |
pout(_L("N4 fixed point "),TReal64(n4*15)*TReal64(xtra),2,x,time,calibrate,4);
|
sl@0
|
250 |
|
sl@0
|
251 |
// Section 5, Trig functions
|
sl@0
|
252 |
x=0.5;
|
sl@0
|
253 |
TReal64 y=0.5;
|
sl@0
|
254 |
TReal64 trg1,trg2,trg3,trg4;
|
sl@0
|
255 |
|
sl@0
|
256 |
timea.HomeTime();
|
sl@0
|
257 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
258 |
{
|
sl@0
|
259 |
for(i=1; i<n5; i++)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
Math::Sin(trg1,x);
|
sl@0
|
262 |
Math::Cos(trg2,x);
|
sl@0
|
263 |
Math::Cos(trg3,x+y);
|
sl@0
|
264 |
Math::Cos(trg4,x-y);
|
sl@0
|
265 |
Math::ATan(x,(t2*trg1*trg2)/(trg3+trg4-1.0));
|
sl@0
|
266 |
x*=t;
|
sl@0
|
267 |
Math::Sin(trg1,y);
|
sl@0
|
268 |
Math::Cos(trg2,y);
|
sl@0
|
269 |
Math::Cos(trg3,x+y);
|
sl@0
|
270 |
Math::Cos(trg4,x-y);
|
sl@0
|
271 |
Math::ATan(y,(t2*trg1*trg2)/(trg3+trg4-1.0));
|
sl@0
|
272 |
y*=t;
|
sl@0
|
273 |
}
|
sl@0
|
274 |
t=1.0-t;
|
sl@0
|
275 |
}
|
sl@0
|
276 |
t=t0;
|
sl@0
|
277 |
timeb.HomeTime();
|
sl@0
|
278 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
279 |
|
sl@0
|
280 |
pout(_L("N5 sin,cos etc. "),TReal64(n5*26)*TReal64(xtra),2,y,time,calibrate,5);
|
sl@0
|
281 |
|
sl@0
|
282 |
// Section 6, Procedure calls
|
sl@0
|
283 |
x=1.0;
|
sl@0
|
284 |
y=1.0;
|
sl@0
|
285 |
TReal64 z=1.0;
|
sl@0
|
286 |
|
sl@0
|
287 |
timea.HomeTime();
|
sl@0
|
288 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
for(i=0; i<n6; i++)
|
sl@0
|
291 |
p3(&x,&y,&z,t,t1,t2);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
timeb.HomeTime();
|
sl@0
|
294 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
295 |
|
sl@0
|
296 |
pout(_L("N6 floating point "),TReal64(n6*6)*TReal64(xtra),1,z,time,calibrate,6);
|
sl@0
|
297 |
|
sl@0
|
298 |
// Section 7, Array refrences
|
sl@0
|
299 |
j = 0;
|
sl@0
|
300 |
k = 1;
|
sl@0
|
301 |
l = 2;
|
sl@0
|
302 |
|
sl@0
|
303 |
TReal64 e2[]=
|
sl@0
|
304 |
{1.0,2.0,3.0};
|
sl@0
|
305 |
|
sl@0
|
306 |
timea.HomeTime();
|
sl@0
|
307 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
308 |
{
|
sl@0
|
309 |
for(i=0;i<n7;i++)
|
sl@0
|
310 |
po(&e2[0],j,k,l);
|
sl@0
|
311 |
}
|
sl@0
|
312 |
timeb.HomeTime();
|
sl@0
|
313 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
314 |
|
sl@0
|
315 |
pout(_L("N7 assignments "),TReal64(n7*3)*TReal64(xtra),2,e2[2],time,calibrate,7);
|
sl@0
|
316 |
|
sl@0
|
317 |
// Section 8, Standard functions
|
sl@0
|
318 |
x=0.75;
|
sl@0
|
319 |
|
sl@0
|
320 |
timea.HomeTime();
|
sl@0
|
321 |
for (ix=0; ix<xtra; ix++)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
for(i=0; i<n8; i++)
|
sl@0
|
324 |
{
|
sl@0
|
325 |
Math::Log(trg1,x);
|
sl@0
|
326 |
Math::Exp(trg1,trg1/t1);
|
sl@0
|
327 |
Math::Sqrt(x,trg1);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
}
|
sl@0
|
330 |
timeb.HomeTime();
|
sl@0
|
331 |
time=I64REAL(timeb.Int64()-timea.Int64())/1E+6;
|
sl@0
|
332 |
|
sl@0
|
333 |
|
sl@0
|
334 |
pout(_L("N8 exp,sqrt etc. "),TReal64(n8*4)*TReal64(xtra),2,x,time,calibrate,8);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
|
sl@0
|
337 |
GLDEF_C void CallTestsL(void)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
|
sl@0
|
340 |
TInt calibrate=1;
|
sl@0
|
341 |
TInt xtra=1;
|
sl@0
|
342 |
TInt section;
|
sl@0
|
343 |
TInt x100=100;
|
sl@0
|
344 |
TInt duration=100;
|
sl@0
|
345 |
|
sl@0
|
346 |
test.Title();
|
sl@0
|
347 |
|
sl@0
|
348 |
#ifdef T_WHET_WITH_VFP
|
sl@0
|
349 |
TInt supportedModes;
|
sl@0
|
350 |
if (HAL::Get(HALData::EHardwareFloatingPoint, supportedModes) != KErrNone)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
test.Printf(_L("No VFP hardware, skipping test\n"));
|
sl@0
|
353 |
return;
|
sl@0
|
354 |
}
|
sl@0
|
355 |
#endif
|
sl@0
|
356 |
|
sl@0
|
357 |
// connect and make directory for write file
|
sl@0
|
358 |
test.Start(_L("Making directory..."));
|
sl@0
|
359 |
TInt r=TheFs.MkDirAll(pathName);
|
sl@0
|
360 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
361 |
test(TheFs.SetSessionPath(pathName)==KErrNone);
|
sl@0
|
362 |
test(outfile.Replace(TheFs,fileName,EFileWrite)==KErrNone);
|
sl@0
|
363 |
|
sl@0
|
364 |
// calibrate
|
sl@0
|
365 |
test.Next(_L("Calibrating...\n"));
|
sl@0
|
366 |
TInt count=10;
|
sl@0
|
367 |
|
sl@0
|
368 |
while (count>0)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
TimeUsed=0;
|
sl@0
|
371 |
whetstones(xtra,x100,calibrate);
|
sl@0
|
372 |
|
sl@0
|
373 |
test.Printf(_L("%g Seconds %d Passes (x 100)\n"),TimeUsed,xtra);
|
sl@0
|
374 |
calibrate++;
|
sl@0
|
375 |
count--;
|
sl@0
|
376 |
|
sl@0
|
377 |
if (TimeUsed>2)
|
sl@0
|
378 |
count=0;
|
sl@0
|
379 |
else
|
sl@0
|
380 |
xtra*=5;
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
if (TimeUsed>0)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
TRealX TimeX(TimeUsed);
|
sl@0
|
386 |
TInt TimeInt=TInt(TimeX);
|
sl@0
|
387 |
xtra*=duration/TimeInt;
|
sl@0
|
388 |
}
|
sl@0
|
389 |
if (xtra<1)
|
sl@0
|
390 |
xtra=1;
|
sl@0
|
391 |
|
sl@0
|
392 |
calibrate=0;
|
sl@0
|
393 |
|
sl@0
|
394 |
test.Printf(_L("\nUse %d passes (x 100)\n"),xtra);
|
sl@0
|
395 |
|
sl@0
|
396 |
test.Printf(_L("\nTReal64 C/C++ Whetstone Benchmark\n"));
|
sl@0
|
397 |
test.Printf(_L("\nLoop content Result MFLOPS MOPS Seconds\n\n"));
|
sl@0
|
398 |
|
sl@0
|
399 |
TimeUsed=0;
|
sl@0
|
400 |
whetstones(xtra,x100,calibrate);
|
sl@0
|
401 |
|
sl@0
|
402 |
test.Printf(_L("\nMWIPS "));
|
sl@0
|
403 |
if (TimeUsed>0)
|
sl@0
|
404 |
mwips=(TReal64)(xtra*x100)/(10.0*TimeUsed);
|
sl@0
|
405 |
else
|
sl@0
|
406 |
mwips=0;
|
sl@0
|
407 |
|
sl@0
|
408 |
test.Printf(_L("%- 17g %- 7g\n\n"),mwips,TimeUsed);
|
sl@0
|
409 |
|
sl@0
|
410 |
if (Check==TReal64(0.0))
|
sl@0
|
411 |
test.Printf(_L("Wrong answer "));
|
sl@0
|
412 |
|
sl@0
|
413 |
// Add results to output file whets.res
|
sl@0
|
414 |
appendString(_L("Whetstone TReal64 Benchmark in C/C++\n"));
|
sl@0
|
415 |
appendString(_L("\n\n"));
|
sl@0
|
416 |
appendString(_L("Loop content Result MFLOPS MOPS Seconds\n\n"));
|
sl@0
|
417 |
|
sl@0
|
418 |
for (section=1; section<KSections; section++)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
buf=_L("");
|
sl@0
|
421 |
buf.AppendFormat(_L("%- 20S%- 20g"),&headings[section],results[section]);
|
sl@0
|
422 |
buf8.Copy(buf); // Unicode
|
sl@0
|
423 |
outfile.Write(buf8);
|
sl@0
|
424 |
|
sl@0
|
425 |
if (loop_mops[section]==99999.0f)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
buf=_L("");
|
sl@0
|
428 |
buf.AppendFormat(_L("%- 39g%- 8g\n"),loop_mflops[section],loop_time[section]);
|
sl@0
|
429 |
buf8.Copy(buf); // Unicode
|
sl@0
|
430 |
outfile.Write(buf8);
|
sl@0
|
431 |
}
|
sl@0
|
432 |
else
|
sl@0
|
433 |
{
|
sl@0
|
434 |
buf=_L("");
|
sl@0
|
435 |
buf.AppendFormat(_L(" %- 21g%- 8g\n"),loop_mops[section],loop_time[section]);
|
sl@0
|
436 |
buf8.Copy(buf); // Unicode
|
sl@0
|
437 |
outfile.Write(buf8);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
buf=_L("");
|
sl@0
|
442 |
buf.AppendFormat(_L("\nMWIPS %- 18g %- 8g\n\n"),mwips,TimeUsed);
|
sl@0
|
443 |
buf8.Copy(buf); // Unicode
|
sl@0
|
444 |
outfile.Write(buf8);
|
sl@0
|
445 |
|
sl@0
|
446 |
outfile.Close();
|
sl@0
|
447 |
test.Printf(_L("\nResults are in file whets.res"));
|
sl@0
|
448 |
|
sl@0
|
449 |
test.End();
|
sl@0
|
450 |
return;
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
|