sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32test\demandpaging\t_ramstress.cpp
|
sl@0
|
15 |
// Following this, it requests that the driver continuously attempt
|
sl@0
|
16 |
// to move pages directly.
|
sl@0
|
17 |
// Platforms/Drives/Compatibility:
|
sl@0
|
18 |
// Hardware only. No defrag support on emulator.
|
sl@0
|
19 |
//
|
sl@0
|
20 |
//
|
sl@0
|
21 |
|
sl@0
|
22 |
//! @SYMTestCaseID KBASE-t_ramstress-0606
|
sl@0
|
23 |
//! @SYMTestType CT
|
sl@0
|
24 |
//! @SYMTestCaseDesc RAM Defrag background defrag stresser
|
sl@0
|
25 |
//! @SYMPREQ PREQ308
|
sl@0
|
26 |
//! @SYMTestPriority High
|
sl@0
|
27 |
//! @SYMTestActions t_ramstress loads and opens the logical device driver ("D_RAMSTRESS").
|
sl@0
|
28 |
//! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise
|
sl@0
|
29 |
//! @SYMTestPriority High
|
sl@0
|
30 |
//! @SYMTestStatus Implemented
|
sl@0
|
31 |
//-------------------------------------------------------------------------------------------------
|
sl@0
|
32 |
#include <e32test.h>
|
sl@0
|
33 |
#include <u32hal.h>
|
sl@0
|
34 |
#include <f32file.h>
|
sl@0
|
35 |
#include <e32svr.h>
|
sl@0
|
36 |
#include <hal.h>
|
sl@0
|
37 |
#include "t_ramstress.h"
|
sl@0
|
38 |
|
sl@0
|
39 |
RTest test(_L("T_RAMSTRESS"));
|
sl@0
|
40 |
|
sl@0
|
41 |
RRamStressTestLdd RamstressLdd;
|
sl@0
|
42 |
|
sl@0
|
43 |
|
sl@0
|
44 |
//
|
sl@0
|
45 |
// E32Main
|
sl@0
|
46 |
//
|
sl@0
|
47 |
// Main entry point.
|
sl@0
|
48 |
//
|
sl@0
|
49 |
|
sl@0
|
50 |
TInt E32Main()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
test.Title();
|
sl@0
|
53 |
test.Start(_L("RAM Defrag background stress testing..."));
|
sl@0
|
54 |
|
sl@0
|
55 |
TBuf<256> args;
|
sl@0
|
56 |
User::CommandLine(args);
|
sl@0
|
57 |
TLex lex(args);
|
sl@0
|
58 |
TPtrC token=lex.NextToken();
|
sl@0
|
59 |
if (token.Length() != 0)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
// exit immediately if we are run as part of autotest
|
sl@0
|
62 |
test.End();
|
sl@0
|
63 |
return KErrNone;
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
TInt r = User::LoadLogicalDevice(KRamStressTestLddName);
|
sl@0
|
67 |
test(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
68 |
test(RamstressLdd.Open()==KErrNone);
|
sl@0
|
69 |
|
sl@0
|
70 |
TUint zoneCount = 0;
|
sl@0
|
71 |
TInt ret = UserSvr::HalFunction(EHalGroupRam,ERamHalGetZoneCount,&zoneCount,0);
|
sl@0
|
72 |
test(ret == KErrNone);
|
sl@0
|
73 |
test(zoneCount != 0);
|
sl@0
|
74 |
|
sl@0
|
75 |
TUint index;
|
sl@0
|
76 |
TInt iters = 0;
|
sl@0
|
77 |
while (1)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
for (index = 0; index < zoneCount; index ++)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
RamstressLdd.DoMovePagesInZone(index);
|
sl@0
|
82 |
User::AfterHighRes(1000);
|
sl@0
|
83 |
}
|
sl@0
|
84 |
//## mDH make it run forever iters ++;
|
sl@0
|
85 |
if (iters > 1000000)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
break;
|
sl@0
|
88 |
}
|
sl@0
|
89 |
}
|
sl@0
|
90 |
RamstressLdd.Close();
|
sl@0
|
91 |
test.Next(_L("Ram Defrag : Done"));
|
sl@0
|
92 |
test.End();
|
sl@0
|
93 |
return KErrNone;
|
sl@0
|
94 |
}
|