0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test\bench\t_userasmfnc.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "t_userbm.h"
|
|
19 |
#include <e32huffman.h>
|
|
20 |
#include <e32math.h>
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <e32base_private.h>
|
|
23 |
#include <e32std.h>
|
|
24 |
#include <e32std_private.h>
|
|
25 |
#include <e32svr.h>
|
|
26 |
|
|
27 |
TBool PointsEqual(const TPoint& a, const TPoint& b)
|
|
28 |
{
|
|
29 |
return a.iX == b.iX && a.iY == b.iY;
|
|
30 |
}
|
|
31 |
|
|
32 |
TInt ComparePoints(const TPoint& a, const TPoint& b)
|
|
33 |
{
|
|
34 |
if (a.iX < b.iX)
|
|
35 |
return -1;
|
|
36 |
else if (a.iX > b.iX)
|
|
37 |
return 1;
|
|
38 |
else if (a.iY < b.iY)
|
|
39 |
return -1;
|
|
40 |
else
|
|
41 |
return a.iY < b.iY;
|
|
42 |
}
|
|
43 |
|
|
44 |
RArray<TInt> ArrayTInt; // RArrayPointerBase derived
|
|
45 |
RArray<TUint> ArrayTUint; // RArrayPointerBase derived
|
|
46 |
RPointerArray<TPoint> ArrayTPointPtr;
|
|
47 |
RArray<TPoint> ArrayTPoint;
|
|
48 |
|
|
49 |
TPoint Point(6, 13);
|
|
50 |
TIdentityRelation<TPoint> PointIdentity(PointsEqual);
|
|
51 |
TLinearOrder<TPoint> PointOrder(ComparePoints);
|
|
52 |
|
|
53 |
CObjectConIx* ObjectConIx;
|
|
54 |
CObjectIx* ObjectIx;
|
|
55 |
CObjectCon* ObjectCon;
|
|
56 |
TInt ObjectHandle;
|
|
57 |
|
|
58 |
TUint32 HuffmanTable[] = { 0, 1, 3, 8, 10, 3, 1, 0 };
|
|
59 |
TBitInput BitInput;
|
|
60 |
TUint8 BitData[] = { 0, 0, 0, 0 };
|
|
61 |
|
|
62 |
RRegion Region, Region2, Region3;
|
|
63 |
TRect Rect1(20, 20, 40, 40);
|
|
64 |
|
|
65 |
SPoly* Poly;
|
|
66 |
TRealX PolyXCoeffs[] = { 1.0, 3.0, 5.0 };
|
|
67 |
|
|
68 |
RHeap* Heap;
|
|
69 |
const TInt HeapSize = 32768;
|
|
70 |
const TInt SmallAlloc = 4;
|
|
71 |
const TInt Allocs = HeapSize / 2 / (SmallAlloc + RHeap::EAllocCellSize) / 2 * 2;
|
|
72 |
|
|
73 |
void InitDataL()
|
|
74 |
{
|
|
75 |
TInt array1Data[] = { 1, 2, 3, 5, 7, 11, 13, 17, 23 };
|
|
76 |
for (TUint i = 0 ; i < sizeof(array1Data) / sizeof(TInt) ; ++i)
|
|
77 |
{
|
|
78 |
User::LeaveIfError(ArrayTInt.Append(array1Data[i]));
|
|
79 |
User::LeaveIfError(ArrayTUint.Append(array1Data[i]));
|
|
80 |
TPoint* p = new (ELeave) TPoint(i, array1Data[i]);
|
|
81 |
CleanupStack::PushL(p);
|
|
82 |
User::LeaveIfError(ArrayTPointPtr.Append(p));
|
|
83 |
CleanupStack::Pop(p);
|
|
84 |
User::LeaveIfError(ArrayTPoint.Append(*p));
|
|
85 |
}
|
|
86 |
|
|
87 |
ObjectConIx = CObjectConIx::NewL();
|
|
88 |
ObjectCon = ObjectConIx->CreateL();
|
|
89 |
ObjectIx = CObjectIx::NewL();
|
|
90 |
CObject* o = new (ELeave) CObject;
|
|
91 |
ObjectCon->AddL(o);
|
|
92 |
ObjectHandle = ObjectIx->AddL(o);
|
|
93 |
|
|
94 |
Huffman::HuffmanL(HuffmanTable, sizeof(HuffmanTable) / sizeof(TUint32), HuffmanTable);
|
|
95 |
Huffman::Decoding(HuffmanTable, sizeof(HuffmanTable) / sizeof(TUint32), HuffmanTable);
|
|
96 |
|
|
97 |
Region.AddRect(TRect(10, 10, 30, 30));
|
|
98 |
Region.AddRect(TRect(30, 20, 50, 50));
|
|
99 |
Region.AddRect(TRect(10, 50, 50, 60));
|
|
100 |
|
|
101 |
Region2.AddRect(TRect(0, 40, 100, 60));
|
|
102 |
Region2.AddRect(TRect(40, 0, 60, 100));
|
|
103 |
Region2.AddRect(TRect(30, 30, 70, 70));
|
|
104 |
|
|
105 |
Region3.AddRect(TRect(0, 30, 100, 40));
|
|
106 |
Region3.AddRect(TRect(0, 0, 100, 10));
|
|
107 |
Region3.AddRect(TRect(0, 20, 100, 30));
|
|
108 |
Region3.AddRect(TRect(0, 10, 100, 20));
|
|
109 |
Region3.AddRect(TRect(0, 40, 100, 50));
|
|
110 |
|
|
111 |
Poly = (SPoly*) User::AllocL(sizeof(SPoly) + (3 - 1) * sizeof(TReal));
|
|
112 |
Poly->num = 3;
|
|
113 |
Poly->c[0] = 3;
|
|
114 |
Poly->c[1] = 6;
|
|
115 |
Poly->c[2] = 9;
|
|
116 |
|
|
117 |
Heap = (RHeap*)User::LeaveIfNull(UserHeap::ChunkHeap(NULL, HeapSize, HeapSize));
|
|
118 |
TInt x;
|
|
119 |
TAny* cells[Allocs];
|
|
120 |
for (x=0; x<Allocs; ++x)
|
|
121 |
cells[x] = Heap->Alloc(4);
|
|
122 |
for (x=0; x<Allocs; x += 2)
|
|
123 |
Heap->Free(cells[x]);
|
|
124 |
}
|
|
125 |
|
|
126 |
// Define benchmarks for assembler-coded euser functions. Note that these are
|
|
127 |
// named after the function we're trying to test, which is not necessarily the
|
|
128 |
// one we call.
|
|
129 |
|
|
130 |
// RPointerArrayBase
|
|
131 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_At,
|
|
132 |
,
|
|
133 |
ArrayTInt[4]);
|
|
134 |
|
|
135 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_Append,
|
|
136 |
RArray<TInt> a,
|
|
137 |
a.Reset(); a.Append(1));
|
|
138 |
|
|
139 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_Find1,
|
|
140 |
,
|
|
141 |
ArrayTInt.Find(5));
|
|
142 |
|
|
143 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_Find2,
|
|
144 |
,
|
|
145 |
ArrayTPointPtr.Find(&Point, PointIdentity));
|
|
146 |
|
|
147 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_BinarySearchSigned,
|
|
148 |
TInt i,
|
|
149 |
ArrayTInt.SpecificFindInOrder(13, i, EArrayFindMode_Any));
|
|
150 |
|
|
151 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_BinarySearchUnsigned,
|
|
152 |
TInt i,
|
|
153 |
ArrayTUint.SpecificFindInOrder(13, i, EArrayFindMode_Any));
|
|
154 |
|
|
155 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_BinarySearch,
|
|
156 |
,
|
|
157 |
ArrayTPointPtr.SpecificFindInOrder(&Point, PointOrder, EArrayFindMode_Any));
|
|
158 |
|
|
159 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_FindIsqSigned,
|
|
160 |
,
|
|
161 |
ArrayTInt.SpecificFindInOrder(5, EArrayFindMode_Any));
|
|
162 |
|
|
163 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_FindIsqUnsigned,
|
|
164 |
,
|
|
165 |
ArrayTUint.SpecificFindInOrder(5, EArrayFindMode_Any));
|
|
166 |
|
|
167 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_FindIsq,
|
|
168 |
,
|
|
169 |
ArrayTPointPtr.SpecificFindInOrder(&Point, PointOrder, EArrayFindMode_Any));
|
|
170 |
|
|
171 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_HeapSortSigned,
|
|
172 |
,
|
|
173 |
ArrayTInt.Sort());
|
|
174 |
|
|
175 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_HeapSortUnsigned,
|
|
176 |
,
|
|
177 |
ArrayTUint.Sort());
|
|
178 |
|
|
179 |
DEFINE_USER_BENCHMARK(RPointerArrayBase_HeapSort,
|
|
180 |
,
|
|
181 |
ArrayTPointPtr.Sort(PointOrder));
|
|
182 |
|
|
183 |
// RArrayBase
|
|
184 |
DEFINE_USER_BENCHMARK(RArrayBase_At,
|
|
185 |
,
|
|
186 |
ArrayTPoint[4]);
|
|
187 |
|
|
188 |
DEFINE_USER_BENCHMARK(RArrayBase_Append,
|
|
189 |
RArray<TPoint> a,
|
|
190 |
a.Reset(); a.Append(Point));
|
|
191 |
|
|
192 |
DEFINE_USER_BENCHMARK(RArrayBase_Find1,
|
|
193 |
,
|
|
194 |
ArrayTPoint.Find(Point));
|
|
195 |
|
|
196 |
DEFINE_USER_BENCHMARK(RArrayBase_Find2,
|
|
197 |
,
|
|
198 |
ArrayTPoint.Find(Point, PointIdentity));
|
|
199 |
|
|
200 |
DEFINE_USER_BENCHMARK(RArrayBase_BinarySearchSigned,
|
|
201 |
TInt i,
|
|
202 |
ArrayTPoint.SpecificFindInSignedKeyOrder(Point, i, EArrayFindMode_Any));
|
|
203 |
|
|
204 |
DEFINE_USER_BENCHMARK(RArrayBase_BinarySearchUnsigned,
|
|
205 |
TInt i,
|
|
206 |
ArrayTPoint.SpecificFindInUnsignedKeyOrder(Point, i, EArrayFindMode_Any));
|
|
207 |
|
|
208 |
DEFINE_USER_BENCHMARK(RArrayBase_BinarySearch,
|
|
209 |
TInt i,
|
|
210 |
ArrayTPoint.FindInOrder(Point, i, PointOrder));
|
|
211 |
|
|
212 |
DEFINE_USER_BENCHMARK(RArrayBase_FindIsqSigned,
|
|
213 |
,
|
|
214 |
ArrayTPoint.SpecificFindInSignedKeyOrder(Point, EArrayFindMode_Any));
|
|
215 |
|
|
216 |
DEFINE_USER_BENCHMARK(RArrayBase_FindIsqUnsigned,
|
|
217 |
,
|
|
218 |
ArrayTPoint.SpecificFindInUnsignedKeyOrder(Point, EArrayFindMode_Any));
|
|
219 |
|
|
220 |
DEFINE_USER_BENCHMARK(RArrayBase_HeapSortSigned,
|
|
221 |
,
|
|
222 |
ArrayTPoint.SortSigned());
|
|
223 |
|
|
224 |
DEFINE_USER_BENCHMARK(RArrayBase_HeapSortUnsigned,
|
|
225 |
,
|
|
226 |
ArrayTPoint.SortUnsigned());
|
|
227 |
|
|
228 |
DEFINE_USER_BENCHMARK(RArrayBase_HeapSort,
|
|
229 |
,
|
|
230 |
ArrayTPointPtr.Sort(PointOrder));
|
|
231 |
|
|
232 |
// CObject related
|
|
233 |
DEFINE_USER_BENCHMARK(CObjectIx_At1,
|
|
234 |
,
|
|
235 |
ObjectIx->At(ObjectHandle));
|
|
236 |
|
|
237 |
DEFINE_USER_BENCHMARK(CObjectIx_At2,
|
|
238 |
,
|
|
239 |
ObjectIx->At(ObjectHandle, 0));
|
|
240 |
|
|
241 |
DEFINE_USER_BENCHMARK(CObjectIx_ArrayOperator,
|
|
242 |
,
|
|
243 |
(*ObjectIx)[0]);
|
|
244 |
|
|
245 |
DEFINE_USER_BENCHMARK(CObjectCon_ArrayOperator,
|
|
246 |
,
|
|
247 |
(*ObjectCon)[0]);
|
|
248 |
|
|
249 |
DEFINE_USER_BENCHMARK(CObjectCon_At,
|
|
250 |
,
|
|
251 |
ObjectCon->At(ObjectHandle));
|
|
252 |
|
|
253 |
DEFINE_USER_BENCHMARK(CObjectCon_AtL,
|
|
254 |
,
|
|
255 |
ObjectCon->AtL(ObjectHandle));
|
|
256 |
|
|
257 |
// Huffman coding
|
|
258 |
DEFINE_USER_BENCHMARK(TBitInput_ReadL1,
|
|
259 |
,
|
|
260 |
BitInput.Set(BitData, 128); BitInput.ReadL());
|
|
261 |
|
|
262 |
DEFINE_USER_BENCHMARK(TBitInput_ReadL2,
|
|
263 |
,
|
|
264 |
BitInput.Set(BitData, 128); BitInput.ReadL(7));
|
|
265 |
|
|
266 |
DEFINE_USER_BENCHMARK(TBitInput_HuffmanL,
|
|
267 |
,
|
|
268 |
BitInput.Set(BitData, 128); BitInput.HuffmanL(HuffmanTable));
|
|
269 |
|
|
270 |
// Regions
|
|
271 |
DEFINE_USER_BENCHMARK(TRegion_BoundingRect,
|
|
272 |
,
|
|
273 |
Region.BoundingRect());
|
|
274 |
|
|
275 |
DEFINE_USER_BENCHMARK(TRegion_IsContainedBy,
|
|
276 |
TRect r(0,0,90,90),
|
|
277 |
Region.IsContainedBy(r));
|
|
278 |
|
|
279 |
DEFINE_USER_BENCHMARK(TRegion_Copy,
|
|
280 |
RRegion r,
|
|
281 |
r.Copy(Region));
|
|
282 |
|
|
283 |
DEFINE_USER_BENCHMARK(TRegion_Offset1,
|
|
284 |
,
|
|
285 |
Region.Offset(0, 0));
|
|
286 |
|
|
287 |
DEFINE_USER_BENCHMARK(TRegion_Contains,
|
|
288 |
TPoint p(0, 0),
|
|
289 |
Region.Contains(p));
|
|
290 |
|
|
291 |
DEFINE_USER_BENCHMARK(TRegion_Intersects,
|
|
292 |
TRect r(0, 0, 10, 10),
|
|
293 |
Region2.Intersects(r));
|
|
294 |
|
|
295 |
DEFINE_USER_BENCHMARK(TRegion_SubRect,
|
|
296 |
RRegion r,
|
|
297 |
r.Copy(Region); r.SubRect(Rect1));
|
|
298 |
|
|
299 |
DEFINE_USER_BENCHMARK(TRegion_Intersection,
|
|
300 |
RRegion r,
|
|
301 |
r.Intersection(Region, Region2));
|
|
302 |
|
|
303 |
DEFINE_USER_BENCHMARK(TRegion_ClipRect,
|
|
304 |
RRegion r,
|
|
305 |
r.Copy(Region); r.ClipRect(Rect1));
|
|
306 |
|
|
307 |
DEFINE_USER_BENCHMARK(TRegion_Tidy,
|
|
308 |
RRegion r,
|
|
309 |
r.Copy(Region3); r.Tidy());
|
|
310 |
|
|
311 |
// Maths
|
|
312 |
DEFINE_USER_BENCHMARK(Math_Frac,
|
|
313 |
TReal t,
|
|
314 |
Math::Frac(t, KPi));
|
|
315 |
|
|
316 |
DEFINE_USER_BENCHMARK(Math_Int1,
|
|
317 |
TReal t,
|
|
318 |
Math::Int(t, KPi));
|
|
319 |
|
|
320 |
DEFINE_USER_BENCHMARK(Math_Int2,
|
|
321 |
TInt16 t,
|
|
322 |
Math::Int(t, KPi));
|
|
323 |
|
|
324 |
DEFINE_USER_BENCHMARK(Math_Int3,
|
|
325 |
TInt32 t,
|
|
326 |
Math::Int(t, KPi));
|
|
327 |
|
|
328 |
DEFINE_USER_BENCHMARK(Math_IsZero,
|
|
329 |
,
|
|
330 |
Math::IsZero(KPi));
|
|
331 |
|
|
332 |
DEFINE_USER_BENCHMARK(Math_IsNaN,
|
|
333 |
,
|
|
334 |
Math::IsNaN(KPi));
|
|
335 |
|
|
336 |
DEFINE_USER_BENCHMARK(Math_IsInfinite,
|
|
337 |
,
|
|
338 |
Math::IsInfinite(KPi));
|
|
339 |
|
|
340 |
DEFINE_USER_BENCHMARK(Math_IsFinite,
|
|
341 |
,
|
|
342 |
Math::IsFinite(KPi));
|
|
343 |
|
|
344 |
DEFINE_USER_BENCHMARK(Math_Sqrt,
|
|
345 |
TReal t,
|
|
346 |
Math::Sqrt(t, KPi));
|
|
347 |
|
|
348 |
DEFINE_USER_BENCHMARK(Math_Poly,
|
|
349 |
TRealX t,
|
|
350 |
Math::PolyX(t, KPi, 3, PolyXCoeffs));
|
|
351 |
|
|
352 |
// Not tested due to not being exported:
|
|
353 |
// Math::SetZero
|
|
354 |
// Math::SetNan
|
|
355 |
// Math::SetInfinite
|
|
356 |
|
|
357 |
// TRealX
|
|
358 |
DEFINE_USER_BENCHMARK(TRealX_Cons1,
|
|
359 |
TRealX t,
|
|
360 |
new (&t) TRealX);
|
|
361 |
|
|
362 |
DEFINE_USER_BENCHMARK(TRealX_Cons2,
|
|
363 |
TRealX t,
|
|
364 |
new (&t) TRealX(0, 0, 0));
|
|
365 |
|
|
366 |
// covers TRealX::Set(TInt), TRealX::TRealX(TInt) and TRealX::operator=(TInt)
|
|
367 |
DEFINE_USER_BENCHMARK(TRealX_SetInt,
|
|
368 |
TRealX t,
|
|
369 |
t = (TInt) 23);
|
|
370 |
|
|
371 |
// covers TRealX::Set(TUint), TRealX::TRealX(TUint) and TRealX::operator=(TUint)
|
|
372 |
DEFINE_USER_BENCHMARK(TRealX_SetUint,
|
|
373 |
TRealX t,
|
|
374 |
t = (TUint) 23);
|
|
375 |
|
|
376 |
// covers TRealX::Set(TInt64), TRealX::TRealX(TInt64) and TRealX::operator=(TInt64)
|
|
377 |
DEFINE_USER_BENCHMARK(TRealX_SetInt64,
|
|
378 |
TRealX t,
|
|
379 |
t = (TInt64) 23);
|
|
380 |
|
|
381 |
// covers TRealX::Set(TReal32), TRealX::TRealX(TReal32) and TRealX::operator=(TReal32)
|
|
382 |
DEFINE_USER_BENCHMARK(TRealX_SetReal32,
|
|
383 |
TRealX t; TReal32 v = 23,
|
|
384 |
t = v);
|
|
385 |
|
|
386 |
// covers TRealX::Set(TReal64), TRealX::TRealX(TReal64) and TRealX::operator=(TReal64)
|
|
387 |
DEFINE_USER_BENCHMARK(TRealX_SetReal64,
|
|
388 |
TRealX t; TReal64 v = 23,
|
|
389 |
t = v);
|
|
390 |
|
|
391 |
DEFINE_USER_BENCHMARK(TRealX_SetZero,
|
|
392 |
TRealX t,
|
|
393 |
t.SetZero(EFalse));
|
|
394 |
|
|
395 |
DEFINE_USER_BENCHMARK(TRealX_SetNaN,
|
|
396 |
TRealX t,
|
|
397 |
t.SetNaN());
|
|
398 |
|
|
399 |
DEFINE_USER_BENCHMARK(TRealX_SetInfinite,
|
|
400 |
TRealX t,
|
|
401 |
t.SetInfinite(EFalse));
|
|
402 |
|
|
403 |
DEFINE_USER_BENCHMARK(TRealX_IsZero,
|
|
404 |
TRealX t,
|
|
405 |
t.IsZero());
|
|
406 |
|
|
407 |
DEFINE_USER_BENCHMARK(TRealX_IsNaN,
|
|
408 |
TRealX t; t.SetNaN(),
|
|
409 |
t.IsNaN());
|
|
410 |
|
|
411 |
DEFINE_USER_BENCHMARK(TRealX_IsInfinite,
|
|
412 |
TRealX t; t.SetInfinite(EFalse),
|
|
413 |
t.IsInfinite());
|
|
414 |
|
|
415 |
DEFINE_USER_BENCHMARK(TRealX_IsFinite,
|
|
416 |
TRealX t,
|
|
417 |
t.IsFinite());
|
|
418 |
|
|
419 |
DEFINE_USER_BENCHMARK(TRealX_Int,
|
|
420 |
TRealX t = 2.3,
|
|
421 |
(TInt) t);
|
|
422 |
|
|
423 |
DEFINE_USER_BENCHMARK(TRealX_Uint,
|
|
424 |
TRealX t = 2.3,
|
|
425 |
(TUint) t);
|
|
426 |
|
|
427 |
DEFINE_USER_BENCHMARK(TRealX_Int64,
|
|
428 |
TRealX t = 2.3,
|
|
429 |
(TInt64) t);
|
|
430 |
|
|
431 |
DEFINE_USER_BENCHMARK(TRealX_Real32,
|
|
432 |
TRealX t = 2.3,
|
|
433 |
(TReal32) t);
|
|
434 |
|
|
435 |
DEFINE_USER_BENCHMARK(TRealX_Real64,
|
|
436 |
TRealX t = 2.3,
|
|
437 |
(TReal64) t);
|
|
438 |
|
|
439 |
DEFINE_USER_BENCHMARK(TRealX_GetReal32,
|
|
440 |
TRealX t = 2.3; TReal32 out,
|
|
441 |
t.GetTReal(out));
|
|
442 |
|
|
443 |
DEFINE_USER_BENCHMARK(TRealX_GetReal64,
|
|
444 |
TRealX t = 2.3; TReal64 out,
|
|
445 |
t.GetTReal(out));
|
|
446 |
|
|
447 |
DEFINE_USER_BENCHMARK(TRealX_UnaryPlus,
|
|
448 |
TRealX t,
|
|
449 |
+t);
|
|
450 |
|
|
451 |
DEFINE_USER_BENCHMARK(TRealX_UnaryMinus,
|
|
452 |
TRealX t,
|
|
453 |
-t);
|
|
454 |
|
|
455 |
DEFINE_USER_BENCHMARK(TRealX_Compare,
|
|
456 |
TRealX a = 0.2; TRealX b = 0.21,
|
|
457 |
a.Compare(b));
|
|
458 |
|
|
459 |
DEFINE_USER_BENCHMARK(TRealX_Sub,
|
|
460 |
TRealX a = 1.0; TRealX b = 0.2,
|
|
461 |
a - b);
|
|
462 |
|
|
463 |
DEFINE_USER_BENCHMARK(TRealX_Add,
|
|
464 |
TRealX a = 1.0; TRealX b = 0.2,
|
|
465 |
a + b);
|
|
466 |
|
|
467 |
DEFINE_USER_BENCHMARK(TRealX_Mult,
|
|
468 |
TRealX a = 1.0; TRealX b = 0.2,
|
|
469 |
a * b);
|
|
470 |
|
|
471 |
DEFINE_USER_BENCHMARK(TRealX_Div,
|
|
472 |
TRealX a = 1.0; TRealX b = 0.2,
|
|
473 |
a / b);
|
|
474 |
|
|
475 |
DEFINE_USER_BENCHMARK(TRealX_Mod,
|
|
476 |
TRealX a = 1.1; TRealX b = 0.2,
|
|
477 |
a % b);
|
|
478 |
|
|
479 |
DEFINE_USER_BENCHMARK(TRealX_PreInc,
|
|
480 |
TRealX t = 0.0,
|
|
481 |
++t);
|
|
482 |
|
|
483 |
DEFINE_USER_BENCHMARK(TRealX_PostInc,
|
|
484 |
TRealX t = 0.0,
|
|
485 |
t++);
|
|
486 |
|
|
487 |
DEFINE_USER_BENCHMARK(TRealX_PreDec,
|
|
488 |
TRealX t = 0.0,
|
|
489 |
--t);
|
|
490 |
|
|
491 |
DEFINE_USER_BENCHMARK(TRealX_PostDec,
|
|
492 |
TRealX t = 0.0,
|
|
493 |
t--);
|
|
494 |
|
|
495 |
DEFINE_USER_BENCHMARK(RHeap_AllocFree,
|
|
496 |
TAny* mem,
|
|
497 |
mem = Heap->Alloc(8);
|
|
498 |
Heap->Free(mem));
|
|
499 |
|
|
500 |
// The following were added for timing functions affected by user-side thread data.
|
|
501 |
|
|
502 |
DEFINE_USER_BENCHMARK(User_Heap,
|
|
503 |
,
|
|
504 |
User::Heap());
|
|
505 |
|
|
506 |
DEFINE_USER_BENCHMARK(CActiveScheduler_Current,
|
|
507 |
,
|
|
508 |
CActiveScheduler::Current());
|
|
509 |
|
|
510 |
DEFINE_USER_BENCHMARK(User_TrapHandler,
|
|
511 |
,
|
|
512 |
User::TrapHandler());
|
|
513 |
|
|
514 |
DEFINE_USER_BENCHMARK(UserSvr_DllSetTls,
|
|
515 |
,
|
|
516 |
UserSvr::DllSetTls(0, 0, 0));
|
|
517 |
|
|
518 |
DEFINE_USER_BENCHMARK(UserSvr_DllTls,
|
|
519 |
,
|
|
520 |
UserSvr::DllTls(0));
|