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