sl@0: // Copyright (c) 2002-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: // e32test\smpsoak\t_smpsoak.h sl@0: sl@0: #if (!defined __T_SMPSOAK_H__) sl@0: #define __T_SMPSOAK_H__ sl@0: sl@0: #define __E32TEST_EXTENSION__ sl@0: // EPOC includes sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // User Includes sl@0: #include "d_smpsoak.h" sl@0: sl@0: TBool TestSilent = EFalse; sl@0: TBool Period = EFalse; sl@0: TBool timeout = EFalse; sl@0: TBool ThreadPriorityLow = EFalse; sl@0: TBuf<25> gCmdLine; sl@0: _LIT(KCmdLineProcess, "%s"); sl@0: _LIT(KCmdLineBackground, "-b %s"); sl@0: _LIT(KCmdLinePeriod, "-p %d %s"); sl@0: sl@0: TUint gPeriod = 10000; sl@0: sl@0: #define PRINT(args)\ sl@0: if (!TestSilent)\ sl@0: test.Printf args sl@0: sl@0: //Global Literals sl@0: _LIT(KGlobalWriteSem, "GlobalWriteSem"); sl@0: _LIT(KGlobalReadSem, "GlobalReadSem"); sl@0: _LIT(KGlobalWRChunk, "GlobalWRChunk"); sl@0: _LIT(KSessionPath, "?:\\SMPSOAK-TST\\"); sl@0: _LIT(KDir, "Dir%d\\"); sl@0: _LIT(KFile, "\\SMPSOAK-TST\\Dir%d\\File%d.txt"); sl@0: _LIT(KFileData, "A$$$BCDEFGHIJKLMNOPQRSTUVWXY$$$Z"); sl@0: const TUint8* pattern = (TText8*)("A11$$222BCDEUVWXY££££$$$Z"); sl@0: sl@0: sl@0: //Global's used between the process sl@0: const TUint32 KCpuAffinityAny=0xffffffffu; sl@0: sl@0: static RSemaphore gWriteSem; sl@0: static RSemaphore gReadSem; sl@0: static RChunk gChunk; sl@0: static volatile TBool gAbort = EFalse; // Set true when escape key pressed sl@0: static RSMPSoak gSMPStressDrv; sl@0: static RSemaphore gSwitchSem; sl@0: sl@0: //Chunk Allocation IPC Read/Write operations sl@0: static const TInt KChunkMaxSize = 0x01000000; //16 MB sl@0: static const TInt KChunkSize = 0x400000; //4MB sl@0: TBuf8 memData; sl@0: sl@0: //Heap Allocations for OOM Threads sl@0: const TInt KHeapMaxiSize = 0x200000; //2MB sl@0: const TInt KHeapReserveSize = 0x100000; //1MB sl@0: RSemaphore ooMemSem; sl@0: sl@0: //For Thread Creation sl@0: const TInt KHeapMinSize= 0x1000; sl@0: const TInt KHeapMaxSize= 0x1000; sl@0: const TInt KTimerPeriod = 10000; sl@0: const TInt KRandSeed= 1234; sl@0: //Used by File thread's sl@0: const TInt KFileNameLength = 100; sl@0: const TInt KPriorityOrder = 4; sl@0: static RTest test(_L("T_SMPSoak")); sl@0: //Enum's for Memory Thread Operations sl@0: enum sl@0: { sl@0: EChunkNone, sl@0: EChunkNormalThread, sl@0: EChunkDisconnectedThread, sl@0: EChunkDoubleEndedThread, sl@0: EChunkNormalProcess, sl@0: EChunkDisconnectedProcess, sl@0: EChunkDoubleEndedProcess, sl@0: }; sl@0: //Process Priority sl@0: enum sl@0: { sl@0: EpriorityFixed, sl@0: EPriorityList, sl@0: EPriorityIncrement, sl@0: EPriorityRandom, sl@0: }; sl@0: //Memory table structure for Memory thread sl@0: struct TMemory sl@0: { sl@0: TPtrC globalChunkName; sl@0: TInt chunkType; sl@0: TInt initialBottom; sl@0: TInt initialTop; sl@0: TInt maxSize; sl@0: }; sl@0: sl@0: struct TChunkInfo sl@0: { sl@0: RChunk chunk; sl@0: TInt lastBottom; sl@0: TInt lastTop; sl@0: }; sl@0: enum sl@0: { sl@0: KNumThreads = 7, sl@0: KNumProcess = 4, sl@0: KNumFileThreads = 4, sl@0: KNumTimerThreads = 2, sl@0: KNumOOMThreads = 4, sl@0: KNumChunks = 13 sl@0: }; sl@0: TInt NumProcess = KNumProcess; sl@0: //Device information for device thread sl@0: _LIT(KDevices,"CDZ"); sl@0: _LIT(KDevLdd1,"ecomm.ldd"); sl@0: _LIT(KDevLdd1Name,"comm"); sl@0: _LIT(KDevLdd2,"elocd.ldd"); sl@0: _LIT(KDevLdd2Name,"LocDrv"); sl@0: _LIT(KDevLdd3,"enet.ldd"); sl@0: _LIT(KDevLdd3Name,"Ethernet"); sl@0: _LIT(KDevLdd4,"esoundsc.ldd"); sl@0: _LIT(KDevLdd4Name,"SoundSc"); sl@0: _LIT(KDevLdd5,"eusbc.ldd"); sl@0: _LIT(KDevLdd5Name, "Usbc"); sl@0: sl@0: //Thread data for each thread sl@0: struct TThreadData sl@0: { sl@0: TInt threadPriorities[4]; sl@0: TInt threadPriorityChange; sl@0: TUint32 cpuAffinity; sl@0: TInt delayTime; sl@0: TInt numThreads; sl@0: TAny *listPtr; sl@0: TInt dirID; sl@0: TInt numFile; sl@0: }; sl@0: sl@0: struct TThread sl@0: { sl@0: TPtrC threadName; sl@0: TThreadFunction threadFunction; sl@0: TThreadData threadData; sl@0: }; sl@0: sl@0: struct TProcess sl@0: { sl@0: TPtrC processFileName; sl@0: TPtrC operation; sl@0: TUint32 cpuAffinity; sl@0: }; sl@0: sl@0: inline void ShowHelp() sl@0: { sl@0: PRINT(_L("***************************************\n")); sl@0: PRINT(_L("The following are immediate commands\n")); sl@0: PRINT(_L("-l run includes Out of Memory thread tests \n")); sl@0: PRINT(_L("-b run in silent mode\n")); sl@0: PRINT(_L("-t nn test run with timeout in seconds\n")); sl@0: PRINT(_L("-p nnnn period for each thread to sleep in iteration\n")); sl@0: PRINT(_L("-h show this help\n")); sl@0: PRINT(_L("Esc to shutdown\n")); sl@0: PRINT(_L("***************************************\n")); sl@0: } sl@0: #endif /* __T_SMPSOAK_H__ */ sl@0: