author | hgs |
Mon, 24 May 2010 18:45:46 +0100 | |
changeset 135 | 5e441a173c63 |
parent 132 | e4a7b1cbe40c |
child 293 | 0659d0e1a03c |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2008-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\demandpaging\t_datapaging.cpp |
|
15 |
// Functional tests for data paging. |
|
16 |
// 002 Test UserHeap::ChunkHeap data paging attributes |
|
17 |
// 003 Test RThread::Create data paging attributes |
|
18 |
// |
|
19 |
// |
|
20 |
||
21 |
//! @SYMTestCaseID KBASE-T_DATAPAGING |
|
22 |
//! @SYMTestType UT |
|
23 |
//! @SYMPREQ PREQ1954 |
|
24 |
//! @SYMTestCaseDesc Data Paging functional tests. |
|
25 |
//! @SYMTestActions 001 Test RChunk data paging attributes |
|
26 |
//! @SYMTestExpectedResults All tests should pass. |
|
27 |
//! @SYMTestPriority High |
|
28 |
//! @SYMTestStatus Implemented |
|
29 |
||
30 |
#define __E32TEST_EXTENSION__ |
|
31 |
#include <e32test.h> |
|
32 |
#include <dptest.h> |
|
33 |
#include <e32hal.h> |
|
34 |
#include <u32exec.h> |
|
35 |
#include <e32svr.h> |
|
36 |
#include <e32panic.h> |
|
37 |
#include "u32std.h" |
|
38 |
#include <e32msgqueue.h> |
|
39 |
#include <e32atomics.h> |
|
40 |
#include <e32math.h> |
|
135 | 41 |
#include <f32file.h> |
0 | 42 |
#include "t_dpcmn.h" |
43 |
#include "../mmu/mmudetect.h" |
|
44 |
#include "../mmu/d_memorytest.h" |
|
45 |
#include "../mmu/paging_info.h" |
|
46 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
47 |
_LIT(KChunkName, "t_datapaging chunk"); |
0 | 48 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
49 |
RTest test(_L("T_DATAPAGING")); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
50 |
SVMSwapInfo InitialSwapInfo; |
0 | 51 |
|
52 |
class TRandom |
|
53 |
{ |
|
54 |
public: |
|
55 |
TRandom(); |
|
56 |
TUint32 Next(); |
|
57 |
||
58 |
private: |
|
59 |
enum |
|
60 |
{ |
|
61 |
KA = 1664525, |
|
62 |
KB = 1013904223 |
|
63 |
}; |
|
64 |
TUint32 iV; |
|
65 |
}; |
|
66 |
||
67 |
TRandom::TRandom() |
|
68 |
{ |
|
69 |
iV = RThread().Id() + User::NTickCount() + 23; |
|
70 |
} |
|
71 |
||
72 |
TUint32 TRandom::Next() |
|
73 |
{ |
|
74 |
iV = KA * iV + KB; |
|
75 |
return iV; |
|
76 |
} |
|
77 |
||
78 |
void CreatePagedChunk(TInt aSizeInPages, TInt aWipeByte = -1) |
|
79 |
{ |
|
80 |
test_Equal(0,gChunk.Handle()); |
|
81 |
||
82 |
TChunkCreateInfo createInfo; |
|
83 |
TInt size = aSizeInPages * gPageSize; |
|
84 |
createInfo.SetNormal(size, size); |
|
85 |
createInfo.SetPaging(TChunkCreateInfo::EPaged); |
|
86 |
createInfo.SetOwner(EOwnerProcess); |
|
87 |
createInfo.SetGlobal(KChunkName); |
|
88 |
if (aWipeByte != -1) |
|
89 |
createInfo.SetClearByte(aWipeByte); |
|
90 |
test_KErrNone(gChunk.Create(createInfo)); |
|
91 |
test(gChunk.IsPaged()); // this is only ever called if data paging is supported |
|
92 |
} |
|
93 |
||
94 |
// The contents of a page is represented as type from enum below ORed with a byte value |
|
95 |
enum TPageContent |
|
96 |
{ |
|
97 |
ETypeUniform = 0 << 8, |
|
98 |
ETypeIncreasing = 1 << 8, |
|
99 |
||
100 |
EContentValueMask = 255, |
|
101 |
EContentTypeMask = 255 << 8 |
|
102 |
}; |
|
103 |
||
104 |
// Write to a page to page it in and verify its previous contents |
|
105 |
void WritePage(TInt aIndex, TUint aExpectedContents, TUint aNewContents) |
|
106 |
{ |
|
107 |
test.Printf(_L(" %3d Write %x\n"), aIndex, aNewContents); |
|
108 |
||
109 |
TUint oldType = aExpectedContents & EContentTypeMask; |
|
110 |
TUint oldValue = aExpectedContents & EContentValueMask; |
|
111 |
||
112 |
TUint type = aNewContents & EContentTypeMask; |
|
113 |
TUint value = aNewContents & EContentValueMask; |
|
114 |
||
115 |
TUint8* page = gChunk.Base() + (gPageSize * aIndex); |
|
116 |
||
117 |
// write first byte first so page is paged in or rejuvenated with write permissions |
|
118 |
page[0] = 0; |
|
119 |
||
120 |
for (TInt i = 0 ; i < gPageSize ; ++i) |
|
121 |
{ |
|
122 |
if (i != 0) |
|
123 |
test_Equal(oldValue, page[i]); |
|
124 |
if (oldType == ETypeIncreasing) |
|
125 |
oldValue = (oldValue + 1) & 255; |
|
126 |
||
127 |
page[i] = value; |
|
128 |
if (type == ETypeIncreasing) |
|
129 |
value = (value + 1) & 255; |
|
130 |
} |
|
131 |
} |
|
132 |
||
133 |
// Read a page and verify its contents |
|
134 |
void ReadPage(TInt aIndex, TUint aExpectedContents) |
|
135 |
{ |
|
136 |
test.Printf(_L(" %3d Read %x\n"), aIndex, aExpectedContents); |
|
137 |
TUint type = aExpectedContents & EContentTypeMask; |
|
138 |
TUint value = aExpectedContents & EContentValueMask; |
|
139 |
TUint8* page = gChunk.Base() + (gPageSize * aIndex); |
|
140 |
for (TInt i = 0 ; i < gPageSize ; ++i) |
|
141 |
{ |
|
142 |
test_Equal(value, page[i]); |
|
143 |
if (type == ETypeIncreasing) |
|
144 |
value = (value + 1) & 255; |
|
145 |
} |
|
146 |
} |
|
147 |
||
148 |
void PageOut() |
|
149 |
{ |
|
150 |
test.Printf(_L(" PageOut\n")); |
|
151 |
DPTest::FlushCache(); |
|
152 |
} |
|
153 |
||
154 |
void TestOnePage() |
|
155 |
{ |
|
156 |
CreatePagedChunk(1, 0xed); |
|
157 |
||
158 |
// Test initial contents (read) |
|
159 |
ReadPage(0, ETypeUniform | 0xed); |
|
160 |
||
161 |
// Test read initial contents after flush (may or may not actually been paged out) |
|
162 |
PageOut(); |
|
163 |
ReadPage(0, ETypeUniform | 0xed); |
|
164 |
||
165 |
// Test page out / page in (read) of dirty contents |
|
166 |
WritePage(0, ETypeUniform | 0xed, ETypeIncreasing | 0x1a); |
|
167 |
PageOut(); |
|
168 |
ReadPage(0, ETypeIncreasing | 0x1a); |
|
169 |
||
170 |
// Test page out / page in (read) of clean contents |
|
171 |
PageOut(); |
|
172 |
ReadPage(0, ETypeIncreasing | 0x1a); |
|
173 |
||
174 |
// Test page out / page in (write) of dirty contents |
|
175 |
WritePage(0, ETypeIncreasing | 0x1a, ETypeIncreasing | 0x23); |
|
176 |
PageOut(); |
|
177 |
WritePage(0, ETypeIncreasing | 0x23, ETypeIncreasing | 0x45); |
|
178 |
||
179 |
CLOSE_AND_WAIT(gChunk); |
|
180 |
CreatePagedChunk(1, 0x0d); |
|
181 |
||
182 |
// Test initial contents (write) |
|
183 |
WritePage(0, ETypeUniform | 0x0d, ETypeIncreasing | 0x1a); |
|
184 |
||
185 |
// Test page out / page in (read) of dirty contents |
|
186 |
PageOut(); |
|
187 |
ReadPage(0, ETypeIncreasing | 0x1a); |
|
188 |
||
189 |
CLOSE_AND_WAIT(gChunk); |
|
190 |
} |
|
191 |
||
192 |
TInt PageInThreadFunc(TAny* aArg) |
|
193 |
{ |
|
194 |
TUint8* page = (TUint8*)aArg; |
|
195 |
for (;;) |
|
196 |
{ |
|
197 |
DPTest::FlushCache(); |
|
198 |
RDebug::Printf("Start page in..."); |
|
199 |
volatile TInt i = page[0]; |
|
200 |
(void)i; |
|
201 |
RDebug::Printf(" done."); |
|
202 |
} |
|
203 |
} |
|
204 |
||
205 |
TInt PageOutThreadFunc(TAny* aArg) |
|
206 |
{ |
|
207 |
TUint8* page = (TUint8*)aArg; |
|
208 |
for (;;) |
|
209 |
{ |
|
210 |
page[0] = 1; // make page dirty |
|
211 |
RDebug::Printf("Start page out..."); |
|
212 |
DPTest::FlushCache(); |
|
213 |
RDebug::Printf(" done."); |
|
214 |
} |
|
215 |
} |
|
216 |
||
217 |
void TestKillThread(TThreadFunction aFunc, TInt aIterations) |
|
218 |
{ |
|
219 |
__KHEAP_MARK; |
|
220 |
TRandom random; |
|
221 |
CreatePagedChunk(1); |
|
222 |
TUint8* page = gChunk.Base(); |
|
223 |
page[0] = 0; // make page dirty |
|
224 |
DPTest::FlushCache(); |
|
225 |
for (TInt i = 0 ; i < aIterations ; ++i) |
|
226 |
{ |
|
227 |
RThread thread; |
|
228 |
test_KErrNone(thread.Create(KNullDesC, aFunc, gPageSize, NULL, page)); |
|
229 |
TRequestStatus status; |
|
230 |
thread.Logon(status); |
|
231 |
thread.Resume(); |
|
232 |
User::AfterHighRes((random.Next() % 50 + 1) * 1000); |
|
233 |
thread.Kill(123); |
|
234 |
User::WaitForRequest(status); |
|
235 |
test_Equal(123, status.Int()); |
|
236 |
CLOSE_AND_WAIT(thread); |
|
237 |
} |
|
238 |
CLOSE_AND_WAIT(gChunk); |
|
132 | 239 |
UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0); |
0 | 240 |
__KHEAP_MARKEND; |
241 |
} |
|
242 |
||
243 |
struct SSoakTestArgs |
|
244 |
{ |
|
245 |
TInt iThreadIndex; |
|
246 |
TInt iPages; |
|
247 |
}; |
|
248 |
||
249 |
TUint32* PageBasePtr(TInt aPage) |
|
250 |
{ |
|
251 |
return (TUint32*)(gChunk.Base() + (gPageSize * aPage)); |
|
252 |
} |
|
253 |
||
254 |
TUint32* PageDataPtr(TInt aPage, TInt aThreadIndex) |
|
255 |
{ |
|
256 |
return (TUint32*)((TUint8*)PageBasePtr(aPage) + ((aThreadIndex * 2 + 1) * sizeof(TUint32))); |
|
257 |
} |
|
258 |
||
259 |
TUint32 PageTag(TInt aPage) |
|
260 |
{ |
|
261 |
return 0x80000000 | aPage; |
|
262 |
} |
|
263 |
||
264 |
void StopSoakTest(RMsgQueue<TInt> aMsgQueue) |
|
265 |
{ |
|
266 |
while(aMsgQueue.Send(0) != KErrOverflow) |
|
267 |
; |
|
268 |
} |
|
269 |
||
270 |
TBool ContinueSoakTest(RMsgQueue<TInt> aMsgQueue) |
|
271 |
{ |
|
272 |
TInt msg; |
|
273 |
return aMsgQueue.Receive(msg) == KErrUnderflow; |
|
274 |
} |
|
275 |
||
276 |
_LIT(KMsgQueueName, "t_datapaging_queue"); |
|
277 |
||
278 |
TInt PinPagesFunc(TAny* aArg) |
|
279 |
{ |
|
280 |
SSoakTestArgs* args = (SSoakTestArgs*)aArg; |
|
281 |
||
282 |
RMemoryTestLdd ldd; |
|
283 |
TInt r = ldd.Open(); |
|
284 |
if (r != KErrNone) |
|
285 |
return r; |
|
286 |
r = ldd.CreateVirtualPinObject(); |
|
287 |
if (r != KErrNone) |
|
288 |
return r; |
|
289 |
||
290 |
RMsgQueue<TInt> msgQueue; |
|
291 |
r = msgQueue.OpenGlobal(KMsgQueueName, EOwnerThread); |
|
292 |
if (r != KErrNone) |
|
293 |
return r; |
|
294 |
||
295 |
TInt i = 0; |
|
296 |
TRandom random; |
|
297 |
while (ContinueSoakTest(msgQueue)) |
|
298 |
{ |
|
299 |
TInt count = 1 + random.Next() % (args->iPages / 4); |
|
300 |
TInt start = random.Next() % (args->iPages - count); |
|
301 |
TInt sleepInMs = 1 + random.Next() % 20; |
|
302 |
TUint32* ptr = PageBasePtr(start); |
|
303 |
||
304 |
r = ldd.PinVirtualMemory((TLinAddr)ptr, count * gPageSize); |
|
305 |
if (r != KErrNone) |
|
306 |
return r; |
|
307 |
||
308 |
User::AfterHighRes(sleepInMs * 1000); |
|
309 |
||
310 |
r = ldd.UnpinVirtualMemory(); |
|
311 |
if (r != KErrNone) |
|
312 |
return r; |
|
313 |
||
314 |
++i; |
|
315 |
} |
|
316 |
||
317 |
msgQueue.Close(); |
|
318 |
||
319 |
r = ldd.DestroyVirtualPinObject(); |
|
320 |
if (r != KErrNone) |
|
321 |
return r; |
|
322 |
ldd.Close(); |
|
323 |
||
324 |
RDebug::Printf(" thread %d performed %d iterations (pinning)", args->iThreadIndex, i); |
|
325 |
return KErrNone; |
|
326 |
} |
|
327 |
||
328 |
TBool TestReadWord(TUint32* aPtr, TUint32 aExpected, TInt aThread, TInt aPage, TInt aIteration, TInt aLine, RMsgQueue<TInt> aMsgQueue) |
|
329 |
{ |
|
330 |
TUint32 aActual = *aPtr; |
|
331 |
if (aActual != aExpected) |
|
332 |
{ |
|
333 |
StopSoakTest(aMsgQueue); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
334 |
RDebug::Printf(" thread %d failure reading page %d at iteration %d address %08x line %d: expected %08x but got %08x", |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
335 |
aThread, aPage, aIteration, aPtr, aLine, aExpected, aActual); |
0 | 336 |
return EFalse; |
337 |
} |
|
338 |
return ETrue; |
|
339 |
} |
|
340 |
||
341 |
TInt SoakTestFunc(TAny* aArg) |
|
342 |
{ |
|
343 |
SSoakTestArgs* args = (SSoakTestArgs*)aArg; |
|
344 |
||
345 |
RMsgQueue<TInt> msgQueue; |
|
346 |
TInt r = msgQueue.OpenGlobal(KMsgQueueName, EOwnerThread); |
|
347 |
if (r != KErrNone) |
|
348 |
return r; |
|
349 |
||
350 |
TUint32* contents = new TUint32[args->iPages]; |
|
351 |
if (contents == NULL) |
|
352 |
return KErrNoMemory; |
|
353 |
Mem::Fill(contents, args->iPages * sizeof(TUint32), 0); |
|
354 |
||
355 |
TInt i = 0; |
|
356 |
TRandom random; |
|
357 |
while (ContinueSoakTest(msgQueue)) |
|
358 |
{ |
|
359 |
TUint32 rand = random.Next(); |
|
360 |
TInt page = rand % args->iPages; |
|
361 |
TUint32* ptr = PageDataPtr(page, args->iThreadIndex); |
|
362 |
TInt action = rand >> 31; |
|
363 |
if (action == 0) |
|
364 |
{ |
|
365 |
if (!TestReadWord(PageBasePtr(page), PageTag(page), args->iThreadIndex, page, i, __LINE__, msgQueue)) |
|
366 |
return KErrGeneral; |
|
367 |
if (!TestReadWord(&ptr[0], contents[page], args->iThreadIndex, page, i, __LINE__, msgQueue)) |
|
368 |
return KErrGeneral; |
|
369 |
if (!TestReadWord(&ptr[1], contents[page], args->iThreadIndex, page, i, __LINE__, msgQueue)) |
|
370 |
return KErrGeneral; |
|
371 |
} |
|
372 |
else |
|
373 |
{ |
|
374 |
TUint newContents = args->iThreadIndex+0x100+(contents[page]&~0xff); |
|
375 |
ptr[0] = newContents; |
|
376 |
if (!TestReadWord(PageBasePtr(page), PageTag(page), args->iThreadIndex, page, i, __LINE__, msgQueue)) |
|
377 |
return KErrGeneral; |
|
378 |
if (!TestReadWord(&ptr[1], contents[page], args->iThreadIndex, page, i, __LINE__, msgQueue)) |
|
379 |
return KErrGeneral; |
|
380 |
ptr[1] = newContents; |
|
381 |
contents[page] = newContents; |
|
382 |
} |
|
383 |
++i; |
|
384 |
} |
|
385 |
||
386 |
for (TInt j = 0 ; j < args->iPages ; ++j) |
|
387 |
{ |
|
388 |
TUint32* ptr = PageDataPtr(j, args->iThreadIndex); |
|
389 |
if (!TestReadWord(PageBasePtr(j), PageTag(j), args->iThreadIndex, j, i, __LINE__, msgQueue)) |
|
390 |
return KErrGeneral; |
|
391 |
if (!TestReadWord(&ptr[0], contents[j], args->iThreadIndex, j, i, __LINE__, msgQueue)) |
|
392 |
return KErrGeneral; |
|
393 |
if (!TestReadWord(&ptr[1], contents[j], args->iThreadIndex, j, i, __LINE__, msgQueue)) |
|
394 |
return KErrGeneral; |
|
395 |
} |
|
396 |
||
397 |
delete [] contents; |
|
398 |
msgQueue.Close(); |
|
399 |
||
400 |
RDebug::Printf(" thread %d performed %d iterations", args->iThreadIndex, i); |
|
401 |
return KErrNone; |
|
402 |
} |
|
403 |
||
404 |
TInt SoakProcess(TInt aProcessIndex, TInt aThreads, TInt aPages, TBool aPinPages) |
|
405 |
{ |
|
406 |
TInt pinThreadIndex = aPinPages ? aThreads++ : -1; |
|
407 |
||
408 |
test_KErrNone(gChunk.OpenGlobal(KChunkName, EFalse)); |
|
409 |
||
410 |
SSoakTestArgs* testArgs = new SSoakTestArgs[aThreads]; |
|
411 |
test_NotNull(testArgs); |
|
412 |
||
413 |
RThread* threads = new RThread[aThreads]; |
|
414 |
test_NotNull(threads); |
|
415 |
||
416 |
TRequestStatus* statuses = new TRequestStatus[aThreads]; |
|
417 |
test_NotNull(statuses); |
|
418 |
||
419 |
TInt i; |
|
420 |
for (i = 0 ; i < aThreads ; ++i) |
|
421 |
{ |
|
422 |
testArgs[i].iThreadIndex = aProcessIndex * aThreads + i; |
|
423 |
testArgs[i].iPages = aPages; |
|
424 |
TThreadFunction func = i == pinThreadIndex ? PinPagesFunc : SoakTestFunc; |
|
425 |
test_KErrNone(threads[i].Create(KNullDesC, func, gPageSize, NULL, &testArgs[i])); |
|
426 |
threads[i].Logon(statuses[i]); |
|
427 |
} |
|
428 |
||
429 |
// todo: rendezvous here? |
|
430 |
||
431 |
for (i = 0 ; i < aThreads ; ++i) |
|
432 |
threads[i].Resume(); |
|
433 |
||
434 |
TBool ok = ETrue; |
|
435 |
for (i = 0 ; i < aThreads ; ++i) |
|
436 |
{ |
|
437 |
User::WaitForRequest(statuses[i]); |
|
438 |
if (threads[i].ExitType() != EExitKill || statuses[i].Int() != KErrNone) |
|
439 |
ok = EFalse; |
|
440 |
threads[i].Close(); |
|
441 |
} |
|
442 |
||
443 |
delete [] testArgs; |
|
444 |
delete [] threads; |
|
445 |
delete [] statuses; |
|
446 |
gChunk.Close(); |
|
447 |
||
448 |
return ok ? KErrNone : KErrGeneral; |
|
449 |
} |
|
450 |
||
451 |
TInt RunSoakProcess() |
|
452 |
{ |
|
453 |
TBuf<80> buf; |
|
454 |
if (User::CommandLineLength() > buf.MaxLength()) |
|
455 |
return KErrArgument; |
|
456 |
User::CommandLine(buf); |
|
457 |
TLex lex(buf); |
|
458 |
||
459 |
TInt index; |
|
460 |
TInt r = lex.Val(index); |
|
461 |
if (r != KErrNone) |
|
462 |
return r; |
|
463 |
lex.SkipSpace(); |
|
464 |
||
465 |
TInt threads; |
|
466 |
r = lex.Val(threads); |
|
467 |
if (r != KErrNone) |
|
468 |
return r; |
|
469 |
lex.SkipSpace(); |
|
470 |
||
471 |
TInt pages; |
|
472 |
r = lex.Val(pages); |
|
473 |
if (r != KErrNone) |
|
474 |
return r; |
|
475 |
lex.SkipSpace(); |
|
476 |
||
477 |
TBool pinPages; |
|
478 |
r = lex.Val(pinPages); |
|
479 |
if (r != KErrNone) |
|
480 |
return r; |
|
481 |
||
482 |
return SoakProcess(index, threads, pages, pinPages); |
|
483 |
} |
|
484 |
||
485 |
void SoakTest(TInt aProcesses, TInt aThreads, TInt aPages, TBool aPinPages, TInt aDurationInSeconds) |
|
486 |
{ |
|
487 |
RDebug::Printf("Soak test: %d processes, %d threads, %d pages, %s pinning for %d seconds", |
|
488 |
aProcesses, aThreads, aPages, (aPinPages ? "with" : "without"), aDurationInSeconds); |
|
489 |
DPTest::FlushCache(); |
|
490 |
||
491 |
TInt totalThreads = (aThreads + (aPinPages ? 1 : 0)) * aProcesses; |
|
492 |
test(totalThreads < 512); // each thread uses two words in a page |
|
493 |
||
494 |
TMediaPagingStats dummy=EMediaPagingStatsRomAndCode; |
|
495 |
PagingInfo::ResetBenchmarks(-1, dummy); // Don't worry about locmedia stats. |
|
496 |
||
497 |
RMsgQueue<TInt> msgQueue; |
|
498 |
test_KErrNone(msgQueue.CreateGlobal(KMsgQueueName, totalThreads, EOwnerThread)); |
|
499 |
||
500 |
CreatePagedChunk(aPages, 0); |
|
501 |
TInt i; |
|
502 |
for (i = 0 ; i < aPages ; ++i) |
|
503 |
*PageBasePtr(i) = PageTag(i); |
|
504 |
||
505 |
RProcess* processes = new RProcess[aProcesses]; |
|
506 |
TRequestStatus* statuses = new TRequestStatus[aProcesses]; |
|
507 |
for (i = 0 ; i < aProcesses ; ++i) |
|
508 |
{ |
|
509 |
TBuf<80> args; |
|
510 |
args.AppendFormat(_L("%d %d %d %d"), i, aThreads, aPages, aPinPages); |
|
511 |
test_KErrNone(processes[i].Create(_L("t_datapaging"), args)); |
|
512 |
processes[i].Logon(statuses[i]); |
|
513 |
} |
|
514 |
||
515 |
RThread().SetPriority(EPriorityMore); // so we don't get starved of CPU by worker threads |
|
516 |
||
517 |
for (i = 0 ; i < aProcesses ; ++i) |
|
518 |
processes[i].Resume(); |
|
519 |
||
520 |
User::After(aDurationInSeconds * 1000000); |
|
521 |
StopSoakTest(msgQueue); |
|
522 |
||
523 |
TBool ok = ETrue; |
|
524 |
for (i = 0 ; i < aProcesses ; ++i) |
|
525 |
{ |
|
526 |
User::WaitForRequest(statuses[i]); |
|
527 |
if (processes[i].ExitType() != EExitKill || statuses[i].Int() != KErrNone) |
|
528 |
{ |
|
529 |
ok = EFalse; |
|
530 |
RDebug::Printf(" process %i died with %d,%d", i, processes[i].ExitType(), statuses[i].Int()); |
|
531 |
} |
|
532 |
processes[i].Close(); |
|
533 |
} |
|
534 |
||
535 |
RThread().SetPriority(EPriorityNormal); |
|
536 |
||
537 |
if (!ok) |
|
538 |
{ |
|
539 |
for (i = 0 ; i < aPages ; ++i) |
|
540 |
{ |
|
541 |
test.Printf(_L("%3d %08x"), i, *PageBasePtr(i)); |
|
542 |
for (TInt j = 0 ; j < totalThreads ; ++j) |
|
543 |
{ |
|
544 |
TUint32* ptr = PageDataPtr(i, j); |
|
545 |
test.Printf(_L(" %08x,%08x"), ptr[0], ptr[1]); |
|
546 |
} |
|
547 |
test.Printf(_L("\n"), i); |
|
548 |
} |
|
549 |
} |
|
550 |
test(ok); |
|
551 |
||
552 |
gChunk.Close(); |
|
553 |
||
554 |
User::After(1000000); |
|
555 |
RDebug::Printf(" done"); |
|
556 |
RDebug::Printf("\n"); |
|
557 |
||
558 |
msgQueue.Close(); |
|
559 |
delete [] processes; |
|
560 |
delete [] statuses; |
|
561 |
||
562 |
PagingInfo::PrintBenchmarks(-1, dummy); // Don't worry about locmedia stats. |
|
563 |
} |
|
564 |
||
565 |
void CommitPage(RChunk chunk, TInt aPageIndex) |
|
566 |
{ |
|
567 |
test_KErrNone(chunk.Commit(aPageIndex * gPageSize, gPageSize)); |
|
568 |
} |
|
569 |
||
570 |
void DecommitPage(RChunk chunk, TInt aPageIndex) |
|
571 |
{ |
|
572 |
test_KErrNone(chunk.Decommit(aPageIndex * gPageSize, gPageSize)); |
|
573 |
} |
|
574 |
||
575 |
void WaitForNotifiers() |
|
576 |
{ |
|
577 |
// wait until notifiers have had chance to signal us... |
|
578 |
UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0); |
|
579 |
} |
|
580 |
||
581 |
void TestSwapHal() |
|
582 |
{ |
|
583 |
test.Next(_L("Test EVMHalGetSwapInfo")); |
|
584 |
||
585 |
TChunkCreateInfo createInfo; |
|
586 |
createInfo.SetDisconnected(0, 0, 256 * gPageSize); |
|
587 |
createInfo.SetPaging(TChunkCreateInfo::EPaged); |
|
588 |
RChunk chunk; |
|
589 |
test_KErrNone(chunk.Create(createInfo)); |
|
590 |
if (gDataPagingSupported) |
|
591 |
test(chunk.IsPaged()); |
|
592 |
||
593 |
SVMSwapInfo swapInfo; |
|
594 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo, 0)); |
|
595 |
test(swapInfo.iSwapFree <= swapInfo.iSwapSize); |
|
596 |
test.Printf(_L(" Swap size == 0x%x bytes\n"), swapInfo.iSwapSize); |
|
597 |
test.Printf(_L(" Swap free == 0x%x bytes\n"), swapInfo.iSwapFree); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
598 |
test(swapInfo.iSwapSize != 0); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
599 |
InitialSwapInfo = swapInfo; |
0 | 600 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
601 |
CommitPage(chunk, 0); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
602 |
SVMSwapInfo swapInfo2; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
603 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo2, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
604 |
test_Equal(swapInfo.iSwapSize, swapInfo2.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
605 |
test_Equal(swapInfo.iSwapFree - gPageSize, swapInfo2.iSwapFree); |
0 | 606 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
607 |
DecommitPage(chunk, 0); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
608 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo2, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
609 |
test_Equal(swapInfo.iSwapSize, swapInfo2.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
610 |
test_Equal(swapInfo.iSwapFree, swapInfo2.iSwapFree); |
0 | 611 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
612 |
// Test that closing the chunk releases the swap page. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
613 |
CommitPage(chunk, 0); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
614 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo2, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
615 |
test_Equal(swapInfo.iSwapSize, swapInfo2.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
616 |
test_Equal(swapInfo.iSwapFree - gPageSize, swapInfo2.iSwapFree); |
0 | 617 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
618 |
chunk.Close(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
619 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo2, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
620 |
test_Equal(swapInfo.iSwapSize, swapInfo2.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
621 |
test_Equal(swapInfo.iSwapFree, swapInfo2.iSwapFree); |
0 | 622 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
623 |
// Chunk must be created for rest of testing. |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
624 |
test_KErrNone(chunk.Create(createInfo)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
625 |
if (gDataPagingSupported) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
626 |
test(chunk.IsPaged()); |
0 | 627 |
|
628 |
// EVMHalSetSwapThresholds, |
|
629 |
test.Next(_L("Test EVMHalSetSwapThresholds")); |
|
630 |
SVMSwapThresholds thresholds; |
|
631 |
thresholds.iLowThreshold = 1; |
|
632 |
thresholds.iGoodThreshold = 0; |
|
633 |
test_Equal(KErrArgument, UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
634 |
thresholds.iLowThreshold = swapInfo.iSwapSize + 1; |
|
635 |
thresholds.iGoodThreshold = swapInfo.iSwapSize + 1; |
|
636 |
test_Equal(KErrArgument, UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
637 |
thresholds.iLowThreshold = 0; |
|
638 |
thresholds.iGoodThreshold = 0; |
|
639 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
640 |
thresholds.iLowThreshold = swapInfo.iSwapSize; |
|
641 |
thresholds.iGoodThreshold = swapInfo.iSwapSize; |
|
642 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
643 |
||
644 |
// test thresholds trigger ok |
|
645 |
||
646 |
RChangeNotifier changes; |
|
647 |
test_KErrNone(changes.Create()); |
|
648 |
TRequestStatus status; |
|
649 |
test_KErrNone(changes.Logon(status)); |
|
650 |
User::WaitForRequest(status); |
|
651 |
test_KErrNone(changes.Logon(status)); |
|
652 |
test_Equal(KRequestPending, status.Int()); |
|
653 |
||
654 |
thresholds.iLowThreshold = swapInfo.iSwapFree - 2 * gPageSize; |
|
655 |
thresholds.iGoodThreshold = swapInfo.iSwapFree - gPageSize; |
|
656 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
657 |
||
658 |
CommitPage(chunk, 0); |
|
659 |
CommitPage(chunk, 1); |
|
660 |
WaitForNotifiers(); |
|
661 |
test_Equal(KRequestPending, status.Int()); |
|
662 |
CommitPage(chunk, 2); |
|
663 |
WaitForNotifiers(); |
|
664 |
test_Equal(EChangesFreeMemory | EChangesLowMemory, status.Int()); |
|
665 |
User::WaitForRequest(status); |
|
666 |
||
667 |
test_KErrNone(changes.Logon(status)); |
|
668 |
DecommitPage(chunk, 2); |
|
669 |
WaitForNotifiers(); |
|
670 |
test_Equal(KRequestPending, status.Int()); |
|
671 |
DecommitPage(chunk, 1); |
|
672 |
WaitForNotifiers(); |
|
673 |
test_Equal(EChangesFreeMemory, status.Int()); |
|
674 |
User::WaitForRequest(status); |
|
675 |
DecommitPage(chunk, 0); |
|
676 |
||
677 |
CLOSE_AND_WAIT(changes); |
|
678 |
||
679 |
// leave some sensible thresholds set |
|
680 |
thresholds.iLowThreshold = (10 * swapInfo.iSwapSize) / 100; |
|
681 |
thresholds.iGoodThreshold = (20 * swapInfo.iSwapSize) / 100; |
|
682 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, &thresholds, 0)); |
|
683 |
||
684 |
CLOSE_AND_WAIT(chunk); |
|
685 |
} |
|
686 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
687 |
void TestSwapInfoUnchanged() |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
688 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
689 |
SVMSwapInfo swapInfo; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
690 |
test_KErrNone(UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, &swapInfo, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
691 |
test.Printf(_L(" Swap size == 0x%x bytes\n"), swapInfo.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
692 |
test.Printf(_L(" Swap free == 0x%x bytes\n"), swapInfo.iSwapFree); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
693 |
test_Equal(InitialSwapInfo.iSwapSize, swapInfo.iSwapSize); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
694 |
test_Equal(InitialSwapInfo.iSwapFree, swapInfo.iSwapFree); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
695 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
696 |
|
0 | 697 |
void TestSwapHalNotSupported() |
698 |
{ |
|
699 |
test_Equal(KErrNotSupported, UserSvr::HalFunction(EHalGroupVM, EVMHalGetSwapInfo, 0, 0)); |
|
700 |
test_Equal(KErrNotSupported, UserSvr::HalFunction(EHalGroupVM, EVMHalSetSwapThresholds, 0, 0)); |
|
701 |
} |
|
702 |
||
703 |
void TestHal() |
|
704 |
{ |
|
705 |
if (gDataPagingSupported) |
|
706 |
TestSwapHal(); |
|
707 |
else |
|
708 |
TestSwapHalNotSupported(); |
|
709 |
} |
|
710 |
||
711 |
||
712 |
TBool gStealEnable = false; |
|
713 |
||
714 |
TInt DecommitThread(TAny*) |
|
715 |
{ |
|
716 |
RThread().SetPriority(EPriorityLess); // so this thread gets pre-empted by StealThread |
|
717 |
TUint8* base = gChunk.Base(); |
|
718 |
TInt size = gChunk.MaxSize(); |
|
719 |
for(;;) |
|
720 |
{ |
|
721 |
// dirty all pages |
|
722 |
for(TInt i=0; i<size; i+=gPageSize) |
|
723 |
base[i] = 0; |
|
724 |
// free pages... |
|
725 |
gStealEnable = true; |
|
726 |
gChunk.Adjust(0); |
|
727 |
gStealEnable = false; |
|
728 |
// recommit pages... |
|
729 |
TInt r = gChunk.Adjust(size); |
|
730 |
if(r!=KErrNone) |
|
731 |
return r; // error |
|
732 |
} |
|
733 |
} |
|
734 |
||
735 |
||
736 |
TInt StealThread(TAny*) |
|
737 |
{ |
|
738 |
for(;;) |
|
739 |
{ |
|
740 |
while(!gStealEnable) |
|
741 |
User::AfterHighRes(0); |
|
742 |
DPTest::FlushCache(); |
|
743 |
} |
|
744 |
} |
|
745 |
||
746 |
||
747 |
void TestDecommitAndStealInteraction(TInt aSeconds) |
|
748 |
{ |
|
749 |
__KHEAP_MARK; |
|
750 |
||
751 |
CreatePagedChunk(256); |
|
752 |
||
753 |
RThread thread1; |
|
754 |
test_KErrNone(thread1.Create(_L("DecommitThread"), DecommitThread, gPageSize, NULL, 0)); |
|
755 |
TRequestStatus status1; |
|
756 |
thread1.Logon(status1); |
|
757 |
||
758 |
RThread thread2; |
|
759 |
test_KErrNone(thread2.Create(_L("StealThread"), StealThread, gPageSize, NULL, 0)); |
|
760 |
TRequestStatus status2; |
|
761 |
thread1.Logon(status2); |
|
762 |
||
763 |
RTimer timer; |
|
764 |
test_KErrNone(timer.CreateLocal()); |
|
765 |
TRequestStatus timeoutStatus; |
|
766 |
timer.After(timeoutStatus,aSeconds*1000000); |
|
767 |
||
768 |
thread1.Resume(); |
|
769 |
thread2.Resume(); |
|
770 |
User::WaitForAnyRequest(); |
|
771 |
||
772 |
thread1.Kill(123); |
|
773 |
User::WaitForRequest(status1); |
|
774 |
test_Equal(123, status1.Int()); |
|
775 |
CLOSE_AND_WAIT(thread1); |
|
776 |
||
777 |
thread2.Kill(123); |
|
778 |
User::WaitForRequest(status2); |
|
779 |
test_Equal(123, status2.Int()); |
|
780 |
CLOSE_AND_WAIT(thread2); |
|
781 |
||
782 |
CLOSE_AND_WAIT(timer); |
|
783 |
test_KErrNone(timeoutStatus.Int()); |
|
784 |
||
785 |
CLOSE_AND_WAIT(gChunk); |
|
132 | 786 |
|
787 |
UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0); |
|
788 |
||
0 | 789 |
__KHEAP_MARKEND; |
790 |
} |
|
791 |
||
792 |
TInt ThreadAtomic64Flush(TAny*) |
|
793 |
{ |
|
794 |
TInt64 seed = 0x33333333; |
|
795 |
FOREVER |
|
796 |
{ |
|
797 |
DPTest::FlushCache(); |
|
798 |
User::After(Math::Rand(seed) & 0x48); |
|
799 |
} |
|
800 |
} |
|
801 |
||
802 |
enum TAtomic64Test |
|
803 |
{ |
|
804 |
EAtomic64Add, |
|
805 |
EAtomic64Logic, |
|
806 |
EAtomic64Cas, |
|
807 |
EAtomic64Steps, |
|
808 |
}; |
|
809 |
||
810 |
struct SAtomic64Args |
|
811 |
{ |
|
812 |
TUint iIters; |
|
813 |
TUint64* iData; |
|
814 |
TInt iIncs; |
|
815 |
TUint iClears[64]; |
|
816 |
TUint iSets[64]; |
|
817 |
}; |
|
818 |
||
819 |
||
820 |
TInt ThreadAtomic64Cas(TAny* aArgs) |
|
821 |
{ |
|
822 |
SAtomic64Args& args = *(SAtomic64Args*)aArgs; |
|
823 |
for (TUint i = 0; i < args.iIters; i++) |
|
824 |
{ |
|
825 |
TUint64 setMask = UI64LIT(0xffffffffffffffff); |
|
826 |
TUint64 clrMask = 0; |
|
827 |
if (__e32_atomic_cas_ord64(args.iData, &setMask, clrMask)) |
|
828 |
args.iClears[0]++; |
|
829 |
// Undo any clearing of setMask which will happen if iData is 0. |
|
830 |
setMask = UI64LIT(0xffffffffffffffff); |
|
831 |
if (__e32_atomic_cas_ord64(args.iData, &clrMask, setMask)) |
|
832 |
args.iSets[0]++; |
|
833 |
} |
|
834 |
return KErrNone; |
|
835 |
} |
|
836 |
||
837 |
||
838 |
TInt ThreadAtomic64Logic(TAny* aArgs) |
|
839 |
{ |
|
840 |
TInt r = KErrNone; |
|
841 |
SAtomic64Args& args = *(SAtomic64Args*)aArgs; |
|
842 |
for(TUint i = 0; i < args.iIters; i++) |
|
843 |
{ |
|
844 |
TUint bitNo = (i & 0x3f); |
|
845 |
TUint64 bitMask = ((TUint64)1) << bitNo; |
|
846 |
TUint64 andMask = ~bitMask; |
|
847 |
||
848 |
TUint64 old = __e32_atomic_and_ord64(args.iData, andMask); |
|
849 |
if (old & bitMask) |
|
850 |
args.iClears[bitNo]++; |
|
851 |
||
852 |
old = __e32_atomic_ior_ord64(args.iData, bitMask); |
|
853 |
if (!(old & bitMask)) |
|
854 |
args.iSets[bitNo]++; |
|
855 |
||
856 |
old = __e32_atomic_xor_ord64(args.iData, bitMask); |
|
857 |
if (old & bitMask) |
|
858 |
args.iClears[bitNo]++; |
|
859 |
else |
|
860 |
args.iSets[bitNo]++; |
|
861 |
||
862 |
old = __e32_atomic_axo_ord64(args.iData, UI64LIT(0xffffffffffffffff), bitMask); |
|
863 |
if (old & bitMask) |
|
864 |
args.iClears[bitNo]++; |
|
865 |
else |
|
866 |
args.iSets[bitNo]++; |
|
867 |
||
868 |
} |
|
869 |
return r; |
|
870 |
} |
|
871 |
||
872 |
||
873 |
TInt ThreadAtomic64Add(TAny* aArgs) |
|
874 |
{ |
|
875 |
TInt r = KErrNone; |
|
876 |
SAtomic64Args& args = *(SAtomic64Args*)aArgs; |
|
877 |
for(TUint i = 0; i < args.iIters; i++) |
|
878 |
{ |
|
879 |
TUint64 old = __e32_atomic_add_ord64(args.iData, 1); |
|
880 |
args.iIncs += 1; |
|
881 |
old = __e32_atomic_tau_ord64(args.iData, 1000, 1, 2); |
|
882 |
args.iIncs += (old >= 1000)? 1 : 2; |
|
883 |
old = __e32_atomic_tas_ord64(args.iData, 1000, 1, -1); |
|
884 |
args.iIncs += (old >= 1000)? 1 : -1; |
|
885 |
} |
|
886 |
return r; |
|
887 |
} |
|
888 |
||
889 |
||
890 |
void TestAtomic64() |
|
891 |
{ |
|
892 |
CreatePagedChunk(sizeof(TUint64)); |
|
893 |
TUint64* data = (TUint64*)gChunk.Base(); |
|
894 |
||
895 |
const TUint KThreads = 25; |
|
896 |
RThread threads[KThreads]; |
|
897 |
TRequestStatus stats[KThreads]; |
|
898 |
SAtomic64Args* args = new SAtomic64Args[KThreads]; |
|
899 |
test_NotNull(args); |
|
900 |
||
901 |
for (TInt testStep = EAtomic64Add; testStep < EAtomic64Steps; testStep++) |
|
902 |
{ |
|
903 |
switch (testStep) |
|
904 |
{ |
|
905 |
case EAtomic64Add: |
|
906 |
test.Next(_L("Test 64-bit atomic addition operations")); |
|
907 |
break; |
|
908 |
case EAtomic64Logic: |
|
909 |
test.Next(_L("Test 64-bit atomic logic operations")); |
|
910 |
break; |
|
911 |
case EAtomic64Cas: |
|
912 |
test.Next(_L("Test 64-bit atomic cas operations")); |
|
913 |
break; |
|
914 |
} |
|
915 |
*data = 0; |
|
916 |
RThread threadFlush; |
|
917 |
test_KErrNone(threadFlush.Create(_L("ThreadAtomicFlush"), ThreadAtomic64Flush, gPageSize, NULL, NULL)); |
|
918 |
TRequestStatus status1; |
|
919 |
threadFlush.Logon(status1); |
|
920 |
threadFlush.SetPriority(EPriorityAbsoluteHigh); |
|
921 |
||
922 |
memclr(args, sizeof(SAtomic64Args)*KThreads); |
|
923 |
TUint i = 0; |
|
924 |
for (; i < KThreads; i++) |
|
925 |
{ |
|
926 |
args[i].iIters = 10000; |
|
927 |
args[i].iData = data; |
|
928 |
switch (testStep) |
|
929 |
{ |
|
930 |
case EAtomic64Add: |
|
931 |
test_KErrNone(threads[i].Create(KNullDesC, ThreadAtomic64Add, gPageSize, NULL, (TAny*)&args[i])); |
|
932 |
break; |
|
933 |
case EAtomic64Logic: |
|
934 |
test_KErrNone(threads[i].Create(KNullDesC, ThreadAtomic64Logic, gPageSize, NULL, (TAny*)&args[i])); |
|
935 |
break; |
|
936 |
case EAtomic64Cas: |
|
937 |
test_KErrNone(threads[i].Create(KNullDesC, ThreadAtomic64Cas, gPageSize, NULL, (TAny*)&args[i])); |
|
938 |
break; |
|
939 |
} |
|
940 |
threads[i].Logon(stats[i]); |
|
941 |
} |
|
942 |
threadFlush.Resume(); |
|
943 |
for (i = 0; i < KThreads; i++) |
|
944 |
{ |
|
945 |
threads[i].Resume(); |
|
946 |
} |
|
947 |
||
948 |
// Wait for add threads to complete and kill flushing thread. |
|
949 |
for (i = 0; i < KThreads; i++) |
|
950 |
{ |
|
951 |
User::WaitForRequest(stats[i]); |
|
952 |
test_KErrNone(stats[i].Int()); |
|
953 |
} |
|
954 |
threadFlush.Kill(KErrNone); |
|
955 |
User::WaitForRequest(status1); |
|
956 |
test_KErrNone(status1.Int()); |
|
957 |
TInt64 expected = 0; |
|
958 |
switch (testStep) |
|
959 |
{ |
|
960 |
case EAtomic64Add: |
|
961 |
{ |
|
962 |
for (TUint i = 0; i < KThreads; i++) |
|
963 |
{ |
|
964 |
threads[i].Close(); |
|
965 |
expected += args[i].iIncs; |
|
966 |
} |
|
967 |
break; |
|
968 |
} |
|
969 |
case EAtomic64Logic: |
|
970 |
{ |
|
971 |
TUint totalSets[64]; |
|
972 |
TUint totalClears[64]; |
|
973 |
memclr(totalSets, sizeof(TUint)*64); |
|
974 |
memclr(totalClears, sizeof(TUint)*64); |
|
975 |
for (TUint i = 0; i < KThreads; i++) |
|
976 |
{ |
|
977 |
threads[i].Close(); |
|
978 |
for (TUint j = 0; j < 64; j++) |
|
979 |
{ |
|
980 |
totalSets[j] += args[i].iSets[j]; |
|
981 |
totalClears[j] += args[i].iClears[j]; |
|
982 |
} |
|
983 |
} |
|
984 |
for (TUint j = 0; j < 64; j++) |
|
985 |
{ |
|
986 |
TUint64 bitMask = 1 << j; |
|
987 |
if (totalSets[j] > totalClears[j]) |
|
988 |
{ |
|
989 |
test_Equal(totalSets[j] - 1, totalClears[j]); |
|
990 |
expected |= bitMask; |
|
991 |
} |
|
992 |
else |
|
993 |
{// Can only clear a bit if it was previously set. |
|
994 |
test_Equal(totalClears[j], totalSets[j]); |
|
995 |
} |
|
996 |
} |
|
997 |
break; |
|
998 |
} |
|
999 |
case EAtomic64Cas: |
|
1000 |
{ |
|
1001 |
TUint totalSets = 0; |
|
1002 |
TUint totalClears = 0; |
|
1003 |
for (TUint i = 0; i < KThreads; i++) |
|
1004 |
{ |
|
1005 |
threads[i].Close(); |
|
1006 |
totalSets += args[i].iSets[0]; |
|
1007 |
totalClears += args[i].iClears[0]; |
|
1008 |
} |
|
1009 |
if (totalSets > totalClears) |
|
1010 |
{ |
|
1011 |
test_Equal(totalSets - 1, totalClears); |
|
1012 |
expected = UI64LIT(0xffffffffffffffff); |
|
1013 |
} |
|
1014 |
else |
|
1015 |
{// Can only clear a word if it was previously set. |
|
1016 |
test_Equal(totalClears, totalSets); |
|
1017 |
} |
|
1018 |
break; |
|
1019 |
} |
|
1020 |
} |
|
1021 |
test_Equal(expected, *data); |
|
1022 |
CLOSE_AND_WAIT(threadFlush); |
|
1023 |
} |
|
1024 |
delete[] args; |
|
1025 |
CLOSE_AND_WAIT(gChunk); |
|
1026 |
} |
|
1027 |
||
1028 |
||
1029 |
// |
|
1030 |
// soak test for writeable paged code... |
|
1031 |
// |
|
1032 |
||
1033 |
const TUint KCodeStride = 20; // spacing between generated code |
|
1034 |
||
1035 |
void CodeStart(TUint8* aCode, TUint8* aTarget, TUint32 aInit) |
|
1036 |
{ |
|
1037 |
#if defined(__CPU_X86) |
|
1038 |
aCode[0] = 0xb8; *(TUint32*)&(aCode[1]) = aInit; // mov eax,aInit |
|
1039 |
aCode[5] = 0xe9; *(TUint32*)&(aCode[6]) = aTarget-(aCode+10); // jmp aTarget |
|
1040 |
__ASSERT_COMPILE(KCodeStride>=10); |
|
1041 |
||
1042 |
#elif defined(__CPU_ARM) |
|
1043 |
*(TUint32*)&(aCode[0]) = 0xe59f0000; // ldr r0, [pc, #0] |
|
1044 |
TInt32 offset = (aTarget-aCode-4-8)/4; |
|
1045 |
if(offset&0xff000000u) |
|
1046 |
{ |
|
1047 |
offset ^= 0xff000000u; |
|
1048 |
test_Equal(0,offset&0xff000000u); |
|
1049 |
} |
|
1050 |
*(TUint32*)&(aCode[4]) = 0xea000000|offset; // b aTarget |
|
1051 |
*(TUint32*)&(aCode[8]) = aInit; // dcd aInit |
|
1052 |
__ASSERT_COMPILE(KCodeStride>=12); |
|
1053 |
||
1054 |
#else |
|
1055 |
#error Unknown CPU |
|
1056 |
#endif |
|
1057 |
} |
|
1058 |
||
1059 |
||
1060 |
void CodeStep(TUint8* aCode, TUint8* aTarget, TUint32 aAdd) |
|
1061 |
{ |
|
1062 |
#if defined(__CPU_X86) |
|
1063 |
aCode[0] = 0xd1; aCode[1] = 0xc0; // rol eax, 1 |
|
1064 |
aCode[2] = 0x05; *(TUint32*)&(aCode[3]) = aAdd; // add eax, aAdd |
|
1065 |
aCode[7] = 0xe9; *(TUint32*)&(aCode[8]) = aTarget-(aCode+12); // jmp aTarget |
|
1066 |
__ASSERT_COMPILE(KCodeStride>=12); |
|
1067 |
||
1068 |
#elif defined(__CPU_ARM) |
|
1069 |
*(TUint32*)&(aCode[0]) = 0xe1a00fe0; // ror r0, r0, #31 |
|
1070 |
*(TUint32*)&(aCode[4]) = 0xe59f1004; // ldr r1, [pc, #4] |
|
1071 |
*(TUint32*)&(aCode[8]) = 0xe0800001; // add r0, r0, r1 |
|
1072 |
TInt32 offset = (aTarget-aCode-12-8)/4; |
|
1073 |
if(offset&0xff000000u) |
|
1074 |
{ |
|
1075 |
offset ^= 0xff000000u; |
|
1076 |
test_Equal(0,offset&0xff000000u); |
|
1077 |
} |
|
1078 |
*(TUint32*)&(aCode[12]) = 0xea000000|offset; // b aTarget |
|
1079 |
*(TUint32*)&(aCode[16]) = aAdd; // dcd aAdd |
|
1080 |
__ASSERT_COMPILE(KCodeStride>=20); |
|
1081 |
||
1082 |
#else |
|
1083 |
#error Unknown CPU |
|
1084 |
#endif |
|
1085 |
} |
|
1086 |
||
1087 |
||
1088 |
void CodeEnd(TUint8* aCode) |
|
1089 |
{ |
|
1090 |
#if defined(__CPU_X86) |
|
1091 |
aCode[0] = 0xc3; // ret |
|
1092 |
__ASSERT_COMPILE(KCodeStride>=1); |
|
1093 |
||
1094 |
#elif defined(__CPU_ARM) |
|
1095 |
*(TUint32*)&(aCode[0]) = 0xe12fff1e; // bx lr |
|
1096 |
__ASSERT_COMPILE(KCodeStride>=4); |
|
1097 |
||
1098 |
#else |
|
1099 |
#error Unknown CPU |
|
1100 |
#endif |
|
1101 |
} |
|
1102 |
||
1103 |
||
1104 |
void TestExecutableMemory() |
|
1105 |
{ |
|
1106 |
__KHEAP_MARK; |
|
1107 |
||
1108 |
#if defined(__CPU_ARM) |
|
1109 |
const TUint KMaxChunkSize = 31*1024*1024; // ARM branch instruction limit |
|
1110 |
#else |
|
1111 |
const TUint KMaxChunkSize = 1024*1024*1024; // 1GB |
|
1112 |
#endif |
|
1113 |
const TUint KMaxPages = KMaxChunkSize/gPageSize; |
|
1114 |
TUint sizeInPages = gMaxCacheSize*2; |
|
1115 |
if(sizeInPages>KMaxPages) |
|
1116 |
sizeInPages = KMaxPages; |
|
1117 |
||
1118 |
// create code chunk... |
|
1119 |
test.Start(_L("Create code chunk")); |
|
1120 |
TChunkCreateInfo createInfo; |
|
1121 |
TInt size = sizeInPages * gPageSize; |
|
1122 |
createInfo.SetCode(size, size); |
|
1123 |
createInfo.SetPaging(TChunkCreateInfo::EPaged); |
|
1124 |
createInfo.SetClearByte(0); |
|
1125 |
RChunk chunk; |
|
1126 |
test_KErrNone(chunk.Create(createInfo)); |
|
1127 |
test(chunk.IsPaged()); // this is only ever called if data paging is supported |
|
1128 |
TUint8* base = chunk.Base(); |
|
1129 |
||
1130 |
// create code path through the pages in the chunk with quadratic distribution... |
|
1131 |
test.Next(_L("Weave path")); |
|
1132 |
TInt pathLength = 0; |
|
1133 |
const TUint maxStepsPerPage = gPageSize/KCodeStride; |
|
1134 |
const TInt maxPathLength = sizeInPages*maxStepsPerPage; |
|
1135 |
TUint8** path = (TUint8**)User::Alloc(maxPathLength*sizeof(TUint8*)); |
|
1136 |
test(path!=0); |
|
1137 |
for(TUint page=0; page<sizeInPages; ++page) |
|
1138 |
{ |
|
1139 |
TUint step = (maxStepsPerPage-1)*(page*page)/(sizeInPages*sizeInPages)+1; |
|
1140 |
do path[pathLength++] = base+page*gPageSize+step*KCodeStride; |
|
1141 |
while(--step); |
|
1142 |
} |
|
1143 |
TUint32 rand = 0x12345678; |
|
1144 |
for(TUint scramble=pathLength*4; scramble>0; --scramble) |
|
1145 |
{ |
|
1146 |
// swap random pair of entries on path... |
|
1147 |
TUint i = (TUint)(TUint64(TUint64(rand)*TUint64(pathLength))>>32); |
|
1148 |
rand = rand*69069+1; |
|
1149 |
TUint j = (TUint)(TUint64(TUint64(rand)*TUint64(pathLength))>>32); |
|
1150 |
rand = rand*69069+1; |
|
1151 |
TUint8* t = path[i]; |
|
1152 |
path[i] = path[j]; |
|
1153 |
path[j] = t; |
|
1154 |
} |
|
1155 |
||
1156 |
// write code to generated path... |
|
1157 |
test.Next(_L("Write code")); |
|
1158 |
TUint32 a = 0; |
|
1159 |
TUint32 (*code)() = (TUint32 (*)())path[pathLength-1]; |
|
1160 |
CodeStart(path[pathLength-1],path[pathLength-2],a); |
|
1161 |
while(--pathLength>1) |
|
1162 |
{ |
|
1163 |
rand = rand*69069+1; |
|
1164 |
CodeStep(path[pathLength-1],path[pathLength-2],rand); |
|
1165 |
a = (a<<1)+(a>>31); |
|
1166 |
a += rand; |
|
1167 |
} |
|
1168 |
CodeEnd(path[0]); |
|
1169 |
--pathLength; |
|
1170 |
test_Equal(0,pathLength); |
|
1171 |
test.Next(_L("IMB")); |
|
1172 |
User::IMB_Range(base,base+chunk.Size()); |
|
1173 |
||
1174 |
// run code... |
|
1175 |
TMediaPagingStats dummy=EMediaPagingStatsRomAndCode; |
|
1176 |
PagingInfo::ResetBenchmarks(-1, dummy); // Don't worry about locmedia stats. |
|
1177 |
test.Next(_L("Execute code")); |
|
1178 |
TUint32 result = code(); |
|
1179 |
test_Equal(a,result); |
|
1180 |
PagingInfo::PrintBenchmarks(-1, dummy); // Don't worry about locmedia stats. |
|
1181 |
||
1182 |
// cleanup... |
|
1183 |
test.Next(_L("Cleanup")); |
|
1184 |
User::Free(path); |
|
1185 |
CLOSE_AND_WAIT(chunk); |
|
1186 |
||
1187 |
test.End(); |
|
1188 |
||
1189 |
UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, 0, 0); |
|
1190 |
__KHEAP_MARKEND; |
|
1191 |
} |
|
1192 |
||
1193 |
||
1194 |
||
1195 |
TInt E32Main() |
|
1196 |
{ |
|
1197 |
test_KErrNone(UserHal::PageSizeInBytes(gPageSize)); |
|
1198 |
||
1199 |
if (User::CommandLineLength() != 0) |
|
1200 |
return RunSoakProcess(); |
|
1201 |
||
1202 |
test.Title(); |
|
1203 |
test_KErrNone(GetGlobalPolicies()); |
|
1204 |
||
135 | 1205 |
_LIT(KFileName,"Z:\\Test\\not_data_paged.txt"); |
1206 |
RFs fs; |
|
1207 |
RFile file; |
|
1208 |
TInt error; |
|
1209 |
test(KErrNone == fs.Connect()); |
|
1210 |
error = file.Open(fs, KFileName, EFileRead); |
|
1211 |
TBool isFilePresent = (error == KErrNone); |
|
1212 |
file.Close(); |
|
1213 |
fs.Close(); |
|
1214 |
test(gDataPagingSupported == !isFilePresent); |
|
1215 |
||
0 | 1216 |
test.Start(_L("Test HAL APIs")); |
1217 |
TestHal(); |
|
1218 |
||
1219 |
if (gDataPagingSupported) |
|
1220 |
{ |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1221 |
test.Next(_L("Test reading and writing to a single page")); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1222 |
TestOnePage(); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1223 |
|
0 | 1224 |
test.Next(_L("Test 64-bit atomic operations are atomic with paged out data")); |
1225 |
TestAtomic64(); |
|
1226 |
||
1227 |
test.Next(_L("Test interaction between decommit and steal")); |
|
1228 |
TestDecommitAndStealInteraction(10); |
|
1229 |
||
1230 |
test.Next(_L("Test killing a thread while it's paging in")); |
|
1231 |
TestKillThread(PageInThreadFunc, 200); |
|
1232 |
||
1233 |
test.Next(_L("Test killing a thread while it's paging out")); |
|
1234 |
TestKillThread(PageOutThreadFunc, 200); |
|
1235 |
||
1236 |
test.Next(_L("Test executable memory")); |
|
1237 |
TestExecutableMemory(); |
|
1238 |
||
1239 |
test.Next(_L("Soak tests")); |
|
1240 |
DPTest::FlushCache(); |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1241 |
|
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1242 |
test.Next(_L("Soak test: change maximum cache size to minimal")); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1243 |
TUint cacheOriginalMin = 0; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1244 |
TUint cacheOriginalMax = 0; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1245 |
TUint cacheCurrentSize = 0; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1246 |
//store original values |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1247 |
DPTest::CacheSize(cacheOriginalMin, cacheOriginalMax, cacheCurrentSize); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1248 |
gMaxCacheSize = 256; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1249 |
gMinCacheSize = 64; |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1250 |
test_KErrNone(DPTest::SetCacheSize(gMinCacheSize * gPageSize, gMaxCacheSize * gPageSize)); |
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1251 |
|
0 | 1252 |
for (TUint totalThreads = 1 ; totalThreads <= 64 ; totalThreads *= 4) |
1253 |
{ |
|
1254 |
for (TUint processes = 1 ; processes <= 16 && processes <= totalThreads ; processes *= 4) |
|
1255 |
{ |
|
1256 |
TUint threads = totalThreads / processes; |
|
1257 |
for (TUint pages = gMaxCacheSize / 2 ; pages <= gMaxCacheSize * 2 ; pages *= 2) |
|
1258 |
{ |
|
1259 |
for (TUint pin = 0 ; pin <= 1 ; ++pin) |
|
1260 |
{ |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1261 |
test.Printf(_L("processes=%d threads=%d pages=%d maxcachesize=%d pin=%d\r\n"),processes, threads, pages, gMaxCacheSize,pin); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1262 |
SoakTest(processes, threads, pages, pin, 5); |
0 | 1263 |
} |
1264 |
} |
|
1265 |
} |
|
1266 |
} |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1267 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1268 |
//Reset the cache size to normal |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1269 |
test.Next(_L("Soak test: Reset cache size to normal")); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1270 |
test_KErrNone(DPTest::SetCacheSize(cacheOriginalMin, cacheOriginalMax)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1271 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1272 |
test.Next(_L("Check we haven't leaked any swap in the course of the test")); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1273 |
TestSwapInfoUnchanged(); |
0 | 1274 |
} |
1275 |
||
1276 |
test.End(); |
|
1277 |
return 0; |
|
1278 |
} |