kerneltest/e32test/demandpaging/t_thrash.cpp
changeset 44 36bfc973b146
parent 43 96e5fb8b040d
child 90 947f0dc9f7a8
equal deleted inserted replaced
43:96e5fb8b040d 44:36bfc973b146
   403 	test.Title();
   403 	test.Title();
   404 	test.Start(_L("Test thrashing monitor"));
   404 	test.Start(_L("Test thrashing monitor"));
   405 
   405 
   406 	test_KErrNone(GetGlobalPolicies());
   406 	test_KErrNone(GetGlobalPolicies());
   407 
   407 
       
   408 	TUint cacheOriginalMin = 0;
       
   409 	TUint cacheOriginalMax = 0;
       
   410 	TUint cacheCurrentSize = 0;
       
   411 
       
   412 	if (gDataPagingSupported)
       
   413 		{
       
   414 		test.Next(_L("Thrash test: change maximum cache size to minimal"));
       
   415 		//store original values
       
   416 		DPTest::CacheSize(cacheOriginalMin, cacheOriginalMax, cacheCurrentSize);
       
   417 		gMaxCacheSize = 256;
       
   418 		gMinCacheSize = 64;
       
   419 		test_KErrNone(DPTest::SetCacheSize(gMinCacheSize * gPageSize, gMaxCacheSize * gPageSize));
       
   420 		}
       
   421 
   408 	TBool flexibleMemoryModel = (MemModelAttributes() & EMemModelTypeMask) == EMemModelTypeFlexible;
   422 	TBool flexibleMemoryModel = (MemModelAttributes() & EMemModelTypeMask) == EMemModelTypeFlexible;
   409 	if (flexibleMemoryModel)
   423 	if (flexibleMemoryModel)
   410 		TestThrashHal();
   424 		TestThrashHal();
   411 	else
   425 	else
   412 		TestThrashHalNotSupported();
   426 		TestThrashHalNotSupported();
   414 	if (gDataPagingSupported && User::CommandLineLength() > 0)
   428 	if (gDataPagingSupported && User::CommandLineLength() > 0)
   415 		{		
   429 		{		
   416 		test.Next(_L("Extended thrashing tests"));
   430 		test.Next(_L("Extended thrashing tests"));
   417 		TestThrashing();
   431 		TestThrashing();
   418 		}
   432 		}
       
   433 	if (gDataPagingSupported)
       
   434 		{
       
   435 		//Reset the cache size to normal
       
   436 		test.Next(_L("Thrash test: Reset cache size to normal"));
       
   437 		test_KErrNone(DPTest::SetCacheSize(cacheOriginalMin, cacheOriginalMax));
       
   438 		}
   419 
   439 
   420 	test.End();
   440 	test.End();
   421 	return 0;
   441 	return 0;
   422 	}
   442 	}