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