sl@0
|
1 |
// Copyright (c) 1994-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\buffer\tarraysp.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include <e32math.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
GLREF_D RTest test;
|
sl@0
|
22 |
GLREF_C TInt Random();
|
sl@0
|
23 |
|
sl@0
|
24 |
LOCAL_D TInt Count=0;
|
sl@0
|
25 |
|
sl@0
|
26 |
GLREF_D TLinearOrder<TInt64> Int64Order;
|
sl@0
|
27 |
|
sl@0
|
28 |
volatile TReal Absorber;
|
sl@0
|
29 |
volatile TInt DummyFlag = 1;
|
sl@0
|
30 |
|
sl@0
|
31 |
#undef FOREVER
|
sl@0
|
32 |
#define FOREVER while (DummyFlag)
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
LOCAL_C TInt VerySlowInt64Order(const TInt64& a, const TInt64& b)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
TReal x;
|
sl@0
|
38 |
Math::Ln(x, 2.0);
|
sl@0
|
39 |
Absorber = x;
|
sl@0
|
40 |
if (a < b)
|
sl@0
|
41 |
return -1;
|
sl@0
|
42 |
if (a == b)
|
sl@0
|
43 |
return 0;
|
sl@0
|
44 |
return 1;
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
|
sl@0
|
48 |
LOCAL_C TInt SpeedTest1(TAny* aSem)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
51 |
pS->Signal();
|
sl@0
|
52 |
FOREVER
|
sl@0
|
53 |
{
|
sl@0
|
54 |
TInt i;
|
sl@0
|
55 |
RArray<TInt> a;
|
sl@0
|
56 |
for (i=0; i<1000; i++)
|
sl@0
|
57 |
a.Append(Count++);
|
sl@0
|
58 |
a.Close();
|
sl@0
|
59 |
}
|
sl@0
|
60 |
return KErrNone;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
LOCAL_C TInt SpeedTest2(TAny* aSem)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
66 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(8);
|
sl@0
|
67 |
pS->Signal();
|
sl@0
|
68 |
FOREVER
|
sl@0
|
69 |
{
|
sl@0
|
70 |
TInt i;
|
sl@0
|
71 |
for (i=0; i<1000; i++)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
pA->AppendL(Count++);
|
sl@0
|
74 |
}
|
sl@0
|
75 |
pA->Reset();
|
sl@0
|
76 |
}
|
sl@0
|
77 |
delete pA;
|
sl@0
|
78 |
return KErrNone;
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt Total;
|
sl@0
|
82 |
LOCAL_C TInt SpeedTest3(TAny* aSem)
|
sl@0
|
83 |
{
|
sl@0
|
84 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
85 |
TInt i;
|
sl@0
|
86 |
RArray<TInt> a;
|
sl@0
|
87 |
for (i=0; i<1000; i++)
|
sl@0
|
88 |
a.Append(i);
|
sl@0
|
89 |
pS->Signal();
|
sl@0
|
90 |
FOREVER
|
sl@0
|
91 |
{
|
sl@0
|
92 |
TInt total=0;
|
sl@0
|
93 |
for (i=0; i<1000; i++)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
total+=a[i];
|
sl@0
|
96 |
Count++;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
Total=total;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
return KErrNone;
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
LOCAL_C TInt SpeedTest4(TAny* aSem)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
106 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(8);
|
sl@0
|
107 |
TInt i;
|
sl@0
|
108 |
for (i=0; i<1000; i++)
|
sl@0
|
109 |
{
|
sl@0
|
110 |
pA->AppendL(i);
|
sl@0
|
111 |
}
|
sl@0
|
112 |
pS->Signal();
|
sl@0
|
113 |
FOREVER
|
sl@0
|
114 |
{
|
sl@0
|
115 |
TInt total=0;
|
sl@0
|
116 |
for (i=0; i<1000; i++)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
total+=(*pA)[i];
|
sl@0
|
119 |
Count++;
|
sl@0
|
120 |
}
|
sl@0
|
121 |
Total=total;
|
sl@0
|
122 |
}
|
sl@0
|
123 |
delete pA;
|
sl@0
|
124 |
return KErrNone;
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
LOCAL_C TInt SpeedTest5(TAny* aSem)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
130 |
pS->Signal();
|
sl@0
|
131 |
FOREVER
|
sl@0
|
132 |
{
|
sl@0
|
133 |
TInt i;
|
sl@0
|
134 |
RArray<TInt> a;
|
sl@0
|
135 |
for (i=999; i>=0; i--, Count++)
|
sl@0
|
136 |
a.InsertInOrder(i);
|
sl@0
|
137 |
a.Close();
|
sl@0
|
138 |
}
|
sl@0
|
139 |
return KErrNone;
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
LOCAL_C TInt SpeedTest5a(TAny* aSem)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
145 |
pS->Signal();
|
sl@0
|
146 |
FOREVER
|
sl@0
|
147 |
{
|
sl@0
|
148 |
TInt i;
|
sl@0
|
149 |
RArray<TInt> a;
|
sl@0
|
150 |
for (i=999; i>=0; i--, Count++)
|
sl@0
|
151 |
a.InsertInOrderAllowRepeats(0);
|
sl@0
|
152 |
a.Close();
|
sl@0
|
153 |
}
|
sl@0
|
154 |
return KErrNone;
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
LOCAL_C TInt SpeedTest6(TAny* aSem)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
160 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(8);
|
sl@0
|
161 |
TKeyArrayFix key(0,ECmpTInt);
|
sl@0
|
162 |
pS->Signal();
|
sl@0
|
163 |
FOREVER
|
sl@0
|
164 |
{
|
sl@0
|
165 |
TInt i;
|
sl@0
|
166 |
for (i=999; i>=0; i--, Count++)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
pA->InsertIsqL(i,key);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
pA->Reset();
|
sl@0
|
171 |
}
|
sl@0
|
172 |
delete pA;
|
sl@0
|
173 |
return KErrNone;
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
LOCAL_C TInt SpeedTest7(TAny* aSem)
|
sl@0
|
177 |
{
|
sl@0
|
178 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
179 |
TInt i;
|
sl@0
|
180 |
RArray<TInt> a(1024);
|
sl@0
|
181 |
for (i=0; i<1000; i++)
|
sl@0
|
182 |
a.Append(Random());
|
sl@0
|
183 |
pS->Signal();
|
sl@0
|
184 |
FOREVER
|
sl@0
|
185 |
{
|
sl@0
|
186 |
a.Sort();
|
sl@0
|
187 |
for (i=0; i<1000; i++)
|
sl@0
|
188 |
a[i]=Random();
|
sl@0
|
189 |
Count++;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
return KErrNone;
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
LOCAL_C TInt SpeedTest7b(TAny* aSem)
|
sl@0
|
195 |
{
|
sl@0
|
196 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
197 |
TInt i;
|
sl@0
|
198 |
RArray<TInt64> a(1024);
|
sl@0
|
199 |
for (i=0; i<1000; i++)
|
sl@0
|
200 |
a.Append(MAKE_TINT64(Random(),Random()));
|
sl@0
|
201 |
pS->Signal();
|
sl@0
|
202 |
FOREVER
|
sl@0
|
203 |
{
|
sl@0
|
204 |
a.Sort(Int64Order);
|
sl@0
|
205 |
for (i=0; i<1000; i++)
|
sl@0
|
206 |
a[i]=MAKE_TINT64(Random(),Random());
|
sl@0
|
207 |
Count++;
|
sl@0
|
208 |
}
|
sl@0
|
209 |
return KErrNone;
|
sl@0
|
210 |
}
|
sl@0
|
211 |
|
sl@0
|
212 |
LOCAL_C TInt SpeedTest8(TAny* aSem)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
215 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(1024);
|
sl@0
|
216 |
TKeyArrayFix key(0,ECmpTInt);
|
sl@0
|
217 |
TInt i;
|
sl@0
|
218 |
for (i=0; i<1000; i++)
|
sl@0
|
219 |
pA->AppendL(Random());
|
sl@0
|
220 |
pS->Signal();
|
sl@0
|
221 |
FOREVER
|
sl@0
|
222 |
{
|
sl@0
|
223 |
pA->Sort(key);
|
sl@0
|
224 |
for (i=0; i<1000; i++)
|
sl@0
|
225 |
(*pA)[i]=Random();
|
sl@0
|
226 |
Count++;
|
sl@0
|
227 |
}
|
sl@0
|
228 |
delete pA;
|
sl@0
|
229 |
return KErrNone;
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
LOCAL_C TInt SpeedTest8a(TAny* aSem)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
235 |
CArrayFixFlat<TInt64>* pA=new CArrayFixFlat<TInt64>(1024);
|
sl@0
|
236 |
TKeyArrayFix key(0,ECmpTInt64);
|
sl@0
|
237 |
TInt i;
|
sl@0
|
238 |
for (i=0; i<1000; i++)
|
sl@0
|
239 |
pA->AppendL(MAKE_TINT64(Random(),Random()));
|
sl@0
|
240 |
pS->Signal();
|
sl@0
|
241 |
FOREVER
|
sl@0
|
242 |
{
|
sl@0
|
243 |
pA->Sort(key);
|
sl@0
|
244 |
for (i=0; i<1000; i++)
|
sl@0
|
245 |
(*pA)[i]=MAKE_TINT64(Random(),Random());
|
sl@0
|
246 |
Count++;
|
sl@0
|
247 |
}
|
sl@0
|
248 |
delete pA;
|
sl@0
|
249 |
return KErrNone;
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
LOCAL_C TInt SpeedTest9(TAny* aSem)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
255 |
pS->Signal();
|
sl@0
|
256 |
FOREVER
|
sl@0
|
257 |
{
|
sl@0
|
258 |
TInt i;
|
sl@0
|
259 |
RArray<TInt> a;
|
sl@0
|
260 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
261 |
a.InsertInOrder(Random());
|
sl@0
|
262 |
a.Close();
|
sl@0
|
263 |
}
|
sl@0
|
264 |
return KErrNone;
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
LOCAL_C TInt SpeedTest9b(TAny* aSem)
|
sl@0
|
268 |
{
|
sl@0
|
269 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
270 |
pS->Signal();
|
sl@0
|
271 |
FOREVER
|
sl@0
|
272 |
{
|
sl@0
|
273 |
TInt i;
|
sl@0
|
274 |
RArray<TInt64> a;
|
sl@0
|
275 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
276 |
a.InsertInOrder(MAKE_TINT64(Random(),Random()),Int64Order);
|
sl@0
|
277 |
a.Close();
|
sl@0
|
278 |
}
|
sl@0
|
279 |
return KErrNone;
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
LOCAL_C TInt SpeedTest9q(TAny* aSem)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
285 |
pS->Signal();
|
sl@0
|
286 |
FOREVER
|
sl@0
|
287 |
{
|
sl@0
|
288 |
TInt i;
|
sl@0
|
289 |
RArray<TInt64> a;
|
sl@0
|
290 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
291 |
a.InsertInOrderAllowRepeats(MAKE_TINT64(0,i), &VerySlowInt64Order);
|
sl@0
|
292 |
a.Close();
|
sl@0
|
293 |
}
|
sl@0
|
294 |
return KErrNone;
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
LOCAL_C TInt SpeedTest9r(TAny* aSem)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
300 |
pS->Signal();
|
sl@0
|
301 |
FOREVER
|
sl@0
|
302 |
{
|
sl@0
|
303 |
TInt i;
|
sl@0
|
304 |
RArray<TInt64> a;
|
sl@0
|
305 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
306 |
a.InsertInOrderAllowRepeats(MAKE_TINT64(0,0), &VerySlowInt64Order);
|
sl@0
|
307 |
a.Close();
|
sl@0
|
308 |
}
|
sl@0
|
309 |
return KErrNone;
|
sl@0
|
310 |
}
|
sl@0
|
311 |
|
sl@0
|
312 |
LOCAL_C TInt SpeedTest10(TAny* aSem)
|
sl@0
|
313 |
{
|
sl@0
|
314 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
315 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(8);
|
sl@0
|
316 |
TKeyArrayFix key(0,ECmpTInt);
|
sl@0
|
317 |
pS->Signal();
|
sl@0
|
318 |
FOREVER
|
sl@0
|
319 |
{
|
sl@0
|
320 |
TInt i;
|
sl@0
|
321 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
pA->InsertIsqAllowDuplicatesL(Random(),key);
|
sl@0
|
324 |
}
|
sl@0
|
325 |
pA->Reset();
|
sl@0
|
326 |
}
|
sl@0
|
327 |
delete pA;
|
sl@0
|
328 |
return KErrNone;
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
LOCAL_C TInt SpeedTest10a(TAny* aSem)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
334 |
CArrayFixFlat<TInt64>* pA=new CArrayFixFlat<TInt64>(8);
|
sl@0
|
335 |
TKeyArrayFix key(0,ECmpTInt64);
|
sl@0
|
336 |
pS->Signal();
|
sl@0
|
337 |
FOREVER
|
sl@0
|
338 |
{
|
sl@0
|
339 |
TInt i;
|
sl@0
|
340 |
for (i=0; i<1000; i++, Count++)
|
sl@0
|
341 |
{
|
sl@0
|
342 |
pA->InsertIsqAllowDuplicatesL(MAKE_TINT64(Random(),Random()),key);
|
sl@0
|
343 |
}
|
sl@0
|
344 |
pA->Reset();
|
sl@0
|
345 |
}
|
sl@0
|
346 |
delete pA;
|
sl@0
|
347 |
return KErrNone;
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
LOCAL_C TInt SpeedTest11(TAny* aSem)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
353 |
TInt i;
|
sl@0
|
354 |
RArray<TInt> a(1024);
|
sl@0
|
355 |
for (i=0; i<1024; i++)
|
sl@0
|
356 |
a.Append(i);
|
sl@0
|
357 |
pS->Signal();
|
sl@0
|
358 |
FOREVER
|
sl@0
|
359 |
{
|
sl@0
|
360 |
for (i=0; i<1024; i++)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
a.FindInOrder(i^0x2b9);
|
sl@0
|
363 |
Count++;
|
sl@0
|
364 |
}
|
sl@0
|
365 |
}
|
sl@0
|
366 |
return KErrNone;
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
LOCAL_C TInt SpeedTest11b(TAny* aSem)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
372 |
TInt i;
|
sl@0
|
373 |
RArray<TInt64> a(1024);
|
sl@0
|
374 |
for (i=0; i<1024; i++)
|
sl@0
|
375 |
a.Append(MAKE_TINT64(i>>6,i));
|
sl@0
|
376 |
pS->Signal();
|
sl@0
|
377 |
FOREVER
|
sl@0
|
378 |
{
|
sl@0
|
379 |
for (i=0; i<1024; i++)
|
sl@0
|
380 |
{
|
sl@0
|
381 |
TInt j=i^0x2b9;
|
sl@0
|
382 |
TInt64 x = MAKE_TINT64(j>>6,j);
|
sl@0
|
383 |
a.FindInOrder(x,Int64Order);
|
sl@0
|
384 |
Count++;
|
sl@0
|
385 |
}
|
sl@0
|
386 |
}
|
sl@0
|
387 |
return KErrNone;
|
sl@0
|
388 |
}
|
sl@0
|
389 |
|
sl@0
|
390 |
LOCAL_C TInt SpeedTest12(TAny* aSem)
|
sl@0
|
391 |
{
|
sl@0
|
392 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
393 |
CArrayFixFlat<TInt>* pA=new CArrayFixFlat<TInt>(8);
|
sl@0
|
394 |
TKeyArrayFix key(0,ECmpTInt);
|
sl@0
|
395 |
TInt i;
|
sl@0
|
396 |
for (i=0; i<1024; i++)
|
sl@0
|
397 |
{
|
sl@0
|
398 |
pA->AppendL(i);
|
sl@0
|
399 |
}
|
sl@0
|
400 |
pS->Signal();
|
sl@0
|
401 |
FOREVER
|
sl@0
|
402 |
{
|
sl@0
|
403 |
for (i=0; i<1024; i++)
|
sl@0
|
404 |
{
|
sl@0
|
405 |
TInt j;
|
sl@0
|
406 |
TInt k=i^0x2b9;
|
sl@0
|
407 |
pA->FindIsq(k,key,j);
|
sl@0
|
408 |
Count++;
|
sl@0
|
409 |
}
|
sl@0
|
410 |
}
|
sl@0
|
411 |
delete pA;
|
sl@0
|
412 |
return KErrNone;
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
LOCAL_C TInt SpeedTest12a(TAny* aSem)
|
sl@0
|
416 |
{
|
sl@0
|
417 |
RSemaphore *pS=(RSemaphore*)aSem;
|
sl@0
|
418 |
CArrayFixFlat<TInt64>* pA=new CArrayFixFlat<TInt64>(8);
|
sl@0
|
419 |
TKeyArrayFix key(0,ECmpTInt64);
|
sl@0
|
420 |
TInt i;
|
sl@0
|
421 |
for (i=0; i<1024; i++)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
pA->AppendL(MAKE_TINT64(i>>6,i));
|
sl@0
|
424 |
}
|
sl@0
|
425 |
pS->Signal();
|
sl@0
|
426 |
FOREVER
|
sl@0
|
427 |
{
|
sl@0
|
428 |
for (i=0; i<1024; i++)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
TInt j;
|
sl@0
|
431 |
TInt k=i^0x2b9;
|
sl@0
|
432 |
TInt64 x = MAKE_TINT64(k>>6,k);
|
sl@0
|
433 |
pA->FindIsq(x,key,j);
|
sl@0
|
434 |
Count++;
|
sl@0
|
435 |
}
|
sl@0
|
436 |
}
|
sl@0
|
437 |
delete pA;
|
sl@0
|
438 |
return KErrNone;
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
const TInt KHeapSize=16384;
|
sl@0
|
442 |
LOCAL_C TInt DoSpeedTest(TThreadFunction f)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
RSemaphore sem;
|
sl@0
|
445 |
sem.CreateLocal(0);
|
sl@0
|
446 |
RThread t;
|
sl@0
|
447 |
t.Create(_L("Speedy"),f,KDefaultStackSize,KHeapSize,KHeapSize,&sem);
|
sl@0
|
448 |
t.SetPriority(EPriorityLess);
|
sl@0
|
449 |
Count=0;
|
sl@0
|
450 |
TRequestStatus s;
|
sl@0
|
451 |
t.Logon(s);
|
sl@0
|
452 |
t.Resume();
|
sl@0
|
453 |
sem.Wait();
|
sl@0
|
454 |
User::After(2000000);
|
sl@0
|
455 |
TInt num=Count/2;
|
sl@0
|
456 |
t.Kill(0);
|
sl@0
|
457 |
User::WaitForRequest(s);
|
sl@0
|
458 |
if (t.ExitType()!=EExitKill)
|
sl@0
|
459 |
{
|
sl@0
|
460 |
TExitCategoryName aExitCategory = t.ExitCategory();
|
sl@0
|
461 |
test.Printf(_L("Exit %d %S %d\n"),t.ExitType(),&aExitCategory,t.ExitReason());
|
sl@0
|
462 |
}
|
sl@0
|
463 |
CLOSE_AND_WAIT(t);
|
sl@0
|
464 |
sem.Close();
|
sl@0
|
465 |
return num;
|
sl@0
|
466 |
}
|
sl@0
|
467 |
|
sl@0
|
468 |
GLDEF_C void DoSpeedTests()
|
sl@0
|
469 |
{
|
sl@0
|
470 |
TInt r;
|
sl@0
|
471 |
test.Next(_L("Speed Tests"));
|
sl@0
|
472 |
r=DoSpeedTest(SpeedTest1);
|
sl@0
|
473 |
test.Printf(_L("RArray<TInt> append, %d in 1 second\n"),r);
|
sl@0
|
474 |
r=DoSpeedTest(SpeedTest2);
|
sl@0
|
475 |
test.Printf(_L("CArrayFixFlat<TInt> append, %d in 1 second\n"),r);
|
sl@0
|
476 |
r=DoSpeedTest(SpeedTest3);
|
sl@0
|
477 |
test.Printf(_L("RArray<TInt> access, %d in 1 second\n"),r);
|
sl@0
|
478 |
test(Total==999*1000/2);
|
sl@0
|
479 |
r=DoSpeedTest(SpeedTest4);
|
sl@0
|
480 |
test.Printf(_L("CArrayFixFlat<TInt> access, %d in 1 second\n"),r);
|
sl@0
|
481 |
test(Total==999*1000/2);
|
sl@0
|
482 |
r=DoSpeedTest(SpeedTest5);
|
sl@0
|
483 |
test.Printf(_L("RArray<TInt> InsertInOrder, %d in 1 second\n"),r);
|
sl@0
|
484 |
r=DoSpeedTest(SpeedTest5a);
|
sl@0
|
485 |
test.Printf(_L("RArray<TInt> InsertInOrder repeats, %d in 1 second\n"),r);
|
sl@0
|
486 |
r=DoSpeedTest(SpeedTest6);
|
sl@0
|
487 |
test.Printf(_L("CArrayFixFlat<TInt> InsertIsqL, %d in 1 second\n"),r);
|
sl@0
|
488 |
r=DoSpeedTest(SpeedTest7);
|
sl@0
|
489 |
test.Printf(_L("RArray<TInt> Sort 1000, %d in 1 second\n"),r);
|
sl@0
|
490 |
r=DoSpeedTest(SpeedTest7b);
|
sl@0
|
491 |
test.Printf(_L("RArray<TInt64> Sort 1000, %d in 1 second\n"),r);
|
sl@0
|
492 |
r=DoSpeedTest(SpeedTest8);
|
sl@0
|
493 |
test.Printf(_L("CArrayFixFlat<TInt> Sort 1000, %d in 1 second\n"),r);
|
sl@0
|
494 |
r=DoSpeedTest(SpeedTest8a);
|
sl@0
|
495 |
test.Printf(_L("CArrayFixFlat<TInt64> Sort 1000, %d in 1 second\n"),r);
|
sl@0
|
496 |
r=DoSpeedTest(SpeedTest9);
|
sl@0
|
497 |
test.Printf(_L("RArray<TInt> InsertInOrder random, %d in 1 second\n"),r);
|
sl@0
|
498 |
r=DoSpeedTest(SpeedTest9b);
|
sl@0
|
499 |
test.Printf(_L("RArray<TInt64> InsertInOrder random, %d in 1 second\n"),r);
|
sl@0
|
500 |
r=DoSpeedTest(SpeedTest9q);
|
sl@0
|
501 |
test.Printf(_L("RArray<TInt64> InsertInOrder repeat control, %d in 1 second\n"),r);
|
sl@0
|
502 |
r=DoSpeedTest(SpeedTest9r);
|
sl@0
|
503 |
test.Printf(_L("RArray<TInt64> InsertInOrder repeats, %d in 1 second\n"),r);
|
sl@0
|
504 |
r=DoSpeedTest(SpeedTest10);
|
sl@0
|
505 |
test.Printf(_L("CArrayFixFlat<TInt> InsertIsqL random, %d in 1 second\n"),r);
|
sl@0
|
506 |
r=DoSpeedTest(SpeedTest10a);
|
sl@0
|
507 |
test.Printf(_L("CArrayFixFlat<TInt64> InsertIsqL random, %d in 1 second\n"),r);
|
sl@0
|
508 |
r=DoSpeedTest(SpeedTest11);
|
sl@0
|
509 |
test.Printf(_L("RArray<TInt> FindInOrder, %d in 1 second\n"),r);
|
sl@0
|
510 |
r=DoSpeedTest(SpeedTest11b);
|
sl@0
|
511 |
test.Printf(_L("RArray<TInt64> FindInOrder, %d in 1 second\n"),r);
|
sl@0
|
512 |
r=DoSpeedTest(SpeedTest12);
|
sl@0
|
513 |
test.Printf(_L("CArrayFixFlat<TInt> FindIsqL, %d in 1 second\n"),r);
|
sl@0
|
514 |
r=DoSpeedTest(SpeedTest12a);
|
sl@0
|
515 |
test.Printf(_L("CArrayFixFlat<TInt64> FindIsqL, %d in 1 second\n"),r);
|
sl@0
|
516 |
}
|
sl@0
|
517 |
|