kerneltest/e32test/smpsoak/t_smpsoak.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
   118         {_L(""), EChunkNone, 0, 0, 0 },
   118         {_L(""), EChunkNone, 0, 0, 0 },
   119     };
   119     };
   120 const TDesC* CSMPSoakThread::KDeviceTable[] =
   120 const TDesC* CSMPSoakThread::KDeviceTable[] =
   121     {
   121     {
   122     &KDevices, &KDevLdd1, &KDevLdd1Name, &KDevLdd2, &KDevLdd2Name, &KDevLdd3, &KDevLdd3Name,
   122     &KDevices, &KDevLdd1, &KDevLdd1Name, &KDevLdd2, &KDevLdd2Name, &KDevLdd3, &KDevLdd3Name,
   123     &KDevLdd4, &KDevLdd4Name, NULL
   123     &KDevLdd4, &KDevLdd4Name, &KDevLdd5, &KDevLdd5Name, NULL
   124     };
   124     };
   125 
   125 
   126 //Constructor
   126 //Constructor
   127 CSMPSoakThread::CSMPSoakThread()
   127 CSMPSoakThread::CSMPSoakThread()
   128     { 
   128     { 
   410     }
   410     }
   411 // Member for thread function
   411 // Member for thread function
   412 TInt CSMPSoakThread::DoSMPStressMemoryThread()
   412 TInt CSMPSoakThread::DoSMPStressMemoryThread()
   413 	{
   413 	{
   414 	RTest test(_L("SMPStressMemoryThread"));
   414 	RTest test(_L("SMPStressMemoryThread"));
   415 	test.Start(_L("SMPStressMemoryThread"));
       
   416 	
   415 	
   417 	TMemory *memoryTablePtr;
   416 	TMemory *memoryTablePtr;
   418 	TChunkInfo chunkTable[KNumChunks];
   417 	TChunkInfo chunkTable[KNumChunks];
   419 	TInt ctIndex = 0;
   418 	TInt ctIndex = 0;
   420 	test_KErrNone(UserHal::PageSizeInBytes(gPageSize));
   419 	test_KErrNone(UserHal::PageSizeInBytes(gPageSize));
   476 			ctIndex++;
   475 			ctIndex++;
   477 			memoryTablePtr++;
   476 			memoryTablePtr++;
   478 			}
   477 			}
   479 		User::After(gPeriod);
   478 		User::After(gPeriod);
   480 		}
   479 		}
   481 	test.End();
       
   482 	test.Close();
       
   483 	return 0x00;
   480 	return 0x00;
   484 	}
   481 	}
   485 //Device Thread : will do device associated operation
   482 //Device Thread : will do device associated operation
   486 //param aSmp - CSMPSoakUtil pointer
   483 //param aSmp - CSMPSoakUtil pointer
   487 TInt CSMPSoakThread::SMPStressDeviceThread(TAny* aSmp)
   484 TInt CSMPSoakThread::SMPStressDeviceThread(TAny* aSmp)
   492     }
   489     }
   493 // Member for thread function
   490 // Member for thread function
   494 TInt CSMPSoakThread::DoSMPStressDeviceThread()
   491 TInt CSMPSoakThread::DoSMPStressDeviceThread()
   495 	{
   492 	{
   496 	RTest test(_L("SMPStressDeviceThread"));
   493 	RTest test(_L("SMPStressDeviceThread"));
   497 	test.Start(_L("SMPStressDeviceThread"));
       
   498 	
   494 	
   499 	RTimer timer;
   495 	RTimer timer;
   500 	RFs session;
   496 	RFs session;
   501 	TFileName sessionPath;
   497 	TFileName sessionPath;
   502 
   498 
   541 		for (TInt i = 1; ptrDevices[i] ; i += 2)
   537 		for (TInt i = 1; ptrDevices[i] ; i += 2)
   542 			{
   538 			{
   543 			RDevice device;
   539 			RDevice device;
   544 
   540 
   545 			TInt r = User::LoadLogicalDevice(*ptrDevices[i]);
   541 			TInt r = User::LoadLogicalDevice(*ptrDevices[i]);
   546 			if (r != KErrNone && r != KErrAlreadyExists)
   542 			test(r == KErrNone || r == KErrAlreadyExists);
   547 				{
       
   548 				test.Printf(_L("LDD %S not present\n"), ptrDevices[i]);
       
   549 				continue;
       
   550 				}
       
   551 
   543 
   552 			test_KErrNone(device.Open(*ptrDevices[i+1]));
   544 			test_KErrNone(device.Open(*ptrDevices[i+1]));
   553 
   545 
   554 			TBuf8<64> deviceCaps;
   546 			TBuf8<64> deviceCaps;
   555 			device.GetCaps(deviceCaps);
   547 			device.GetCaps(deviceCaps);
   568 			break;
   560 			break;
   569 		User::After(gPeriod);
   561 		User::After(gPeriod);
   570 		}
   562 		}
   571 	timer.Close();
   563 	timer.Close();
   572 	PRINT((_L("SMPStressDeviceThread MyTimer.Cancel() called\n")));
   564 	PRINT((_L("SMPStressDeviceThread MyTimer.Cancel() called\n")));
   573 	test.End();
       
   574 	test.Close();
       
   575 	return 0x00;
   565 	return 0x00;
   576 	}
   566 	}
   577 //Spin Thread : will do thread sync 
   567 //Spin Thread : will do thread sync 
   578 //param aSmp - CSMPSoakUtil pointer
   568 //param aSmp - CSMPSoakUtil pointer
   579 TInt CSMPSoakThread::SMPStressSpinThread(TAny* aSmp)
   569 TInt CSMPSoakThread::SMPStressSpinThread(TAny* aSmp)
   584     }
   574     }
   585 // Member for thread function
   575 // Member for thread function
   586 TInt CSMPSoakThread::DoSMPStressSpinThread()
   576 TInt CSMPSoakThread::DoSMPStressSpinThread()
   587 	{
   577 	{
   588 	RTest test(_L("SMPStressSpinThread"));
   578 	RTest test(_L("SMPStressSpinThread"));
   589 	test.Start(_L("SMPStressSpinThread"));
       
   590 
   579 
   591 	TTime startTime;
   580 	TTime startTime;
   592 	TTime endTime;
   581 	TTime endTime;
   593 	TTimeIntervalMicroSeconds loopTimeMicroSeconds;
   582 	TTimeIntervalMicroSeconds loopTimeMicroSeconds;
   594 	PRINT (_L("SMPStressSpinThread\n"));
   583 	PRINT (_L("SMPStressSpinThread\n"));
   605 
   594 
   606 		if (gAbort)
   595 		if (gAbort)
   607 			break;
   596 			break;
   608 		User::After(gPeriod);
   597 		User::After(gPeriod);
   609 		}
   598 		}
   610 	test.End();
       
   611 	test.Close();
       
   612 	return 0x00;
   599 	return 0x00;
   613 	}
   600 	}
   614 //Timer Thread : Timer operation and  thread sync 
   601 //Timer Thread : Timer operation and  thread sync 
   615 //param aSmp - CSMPSoakUtil pointer
   602 //param aSmp - CSMPSoakUtil pointer
   616 TInt CSMPSoakThread::SMPStressTimerThread(TAny* aSmp)
   603 TInt CSMPSoakThread::SMPStressTimerThread(TAny* aSmp)
   621     }
   608     }
   622 // Member for thread function
   609 // Member for thread function
   623 TInt CSMPSoakThread::DoSMPStressTimerThread()
   610 TInt CSMPSoakThread::DoSMPStressTimerThread()
   624 	{
   611 	{
   625 	RTest test(_L("SMPStressTimerThread"));
   612 	RTest test(_L("SMPStressTimerThread"));
   626 	test.Start(_L("SMPStressTimerThread"));
       
   627 
   613 
   628 	PRINT (_L("SMPStressTimerThread\n"));
   614 	PRINT (_L("SMPStressTimerThread\n"));
   629 	RTimer timer;
   615 	RTimer timer;
   630 	test_KErrNone(timer.CreateLocal());
   616 	test_KErrNone(timer.CreateLocal());
   631 	TRequestStatus s;
   617 	TRequestStatus s;
   642 			break;
   628 			break;
   643 		User::After(gPeriod);
   629 		User::After(gPeriod);
   644 		}
   630 		}
   645 	timer.Cancel();
   631 	timer.Cancel();
   646 	PRINT((_L("SMPStressTimerThread MyTimer.Cancel() called\n")));
   632 	PRINT((_L("SMPStressTimerThread MyTimer.Cancel() called\n")));
   647 	test.End();
       
   648 	test.Close();
       
   649 	return 0x00;
   633 	return 0x00;
   650 	}
   634 	}
   651 // CActive class to monitor KeyStrokes from User
   635 // CActive class to monitor KeyStrokes from User
   652 class CActiveConsole : public CActive
   636 class CActiveConsole : public CActive
   653 	{
   637 	{