sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32test\demandpaging\t_ramstress.cpp sl@0: // Following this, it requests that the driver continuously attempt sl@0: // to move pages directly. sl@0: // Platforms/Drives/Compatibility: sl@0: // Hardware only. No defrag support on emulator. sl@0: // sl@0: // sl@0: sl@0: //! @SYMTestCaseID KBASE-t_ramstress-0606 sl@0: //! @SYMTestType CT sl@0: //! @SYMTestCaseDesc RAM Defrag background defrag stresser sl@0: //! @SYMPREQ PREQ308 sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestActions t_ramstress loads and opens the logical device driver ("D_RAMSTRESS"). sl@0: //! @SYMTestExpectedResults Finishes if the system behaves as expected, panics otherwise sl@0: //! @SYMTestPriority High sl@0: //! @SYMTestStatus Implemented sl@0: //------------------------------------------------------------------------------------------------- sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "t_ramstress.h" sl@0: sl@0: RTest test(_L("T_RAMSTRESS")); sl@0: sl@0: RRamStressTestLdd RamstressLdd; sl@0: sl@0: sl@0: // sl@0: // E32Main sl@0: // sl@0: // Main entry point. sl@0: // sl@0: sl@0: TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: test.Start(_L("RAM Defrag background stress testing...")); sl@0: sl@0: TBuf<256> args; sl@0: User::CommandLine(args); sl@0: TLex lex(args); sl@0: TPtrC token=lex.NextToken(); sl@0: if (token.Length() != 0) sl@0: { sl@0: // exit immediately if we are run as part of autotest sl@0: test.End(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt r = User::LoadLogicalDevice(KRamStressTestLddName); sl@0: test(r==KErrNone || r==KErrAlreadyExists); sl@0: test(RamstressLdd.Open()==KErrNone); sl@0: sl@0: TUint zoneCount = 0; sl@0: TInt ret = UserSvr::HalFunction(EHalGroupRam,ERamHalGetZoneCount,&zoneCount,0); sl@0: test(ret == KErrNone); sl@0: test(zoneCount != 0); sl@0: sl@0: TUint index; sl@0: TInt iters = 0; sl@0: while (1) sl@0: { sl@0: for (index = 0; index < zoneCount; index ++) sl@0: { sl@0: RamstressLdd.DoMovePagesInZone(index); sl@0: User::AfterHighRes(1000); sl@0: } sl@0: //## mDH make it run forever iters ++; sl@0: if (iters > 1000000) sl@0: { sl@0: break; sl@0: } sl@0: } sl@0: RamstressLdd.Close(); sl@0: test.Next(_L("Ram Defrag : Done")); sl@0: test.End(); sl@0: return KErrNone; sl@0: }