kerneltest/e32test/defrag/t_ramdefrag.cpp
branchRCL_3
changeset 110 c734af59ce98
parent 62 4a8fed1c0ef6
child 117 5b5d147c7838
equal deleted inserted replaced
97:41f0cfe18c80 110:c734af59ce98
    31 #include <e32svr.h>
    31 #include <e32svr.h>
    32 #include <e32msgqueue.h>
    32 #include <e32msgqueue.h>
    33 #include <e32math.h>
    33 #include <e32math.h>
    34 #include <hal.h>
    34 #include <hal.h>
    35 #include "testdefs.h"
    35 #include "testdefs.h"
       
    36 #include "..\mmu\mmudetect.h"
    36 
    37 
    37 
    38 
    38 #include <dptest.h>
    39 #include <dptest.h>
    39 
    40 
    40 #include "t_ramdefrag.h"
    41 #include "t_ramdefrag.h"
   126 LOCAL_D RFile gFile[KNumFilesOrig];
   127 LOCAL_D RFile gFile[KNumFilesOrig];
   127 
   128 
   128 LOCAL_D TInt* gCandList1;											// Array of zones that have the same preference and the same
   129 LOCAL_D TInt* gCandList1;											// Array of zones that have the same preference and the same
   129 LOCAL_D TInt* gCandList2;											// amount of free pages
   130 LOCAL_D TInt* gCandList2;											// amount of free pages
   130 const TInt KInvalidCandIndex = -1;
   131 const TInt KInvalidCandIndex = -1;
       
   132 LOCAL_D TUint gMemModel;
   131 
   133 
   132 //
   134 //
   133 // GetDrive
   135 // GetDrive
   134 //
   136 //
   135 // Gets the removable drive number
   137 // Gets the removable drive number
   487 		TESTDEBUG(test.Printf(_L("Original CacheSize: minCacheSize = 0x%x, maxCacheSize = 0x%x, currentCacheSize = 0x%x\n"), 
   489 		TESTDEBUG(test.Printf(_L("Original CacheSize: minCacheSize = 0x%x, maxCacheSize = 0x%x, currentCacheSize = 0x%x\n"), 
   488 									gOriginalMinCacheSize >> gPageShift, gOriginalMaxCacheSize >> gPageShift, 
   490 									gOriginalMinCacheSize >> gPageShift, gOriginalMaxCacheSize >> gPageShift, 
   489 									currentCacheSize >> gPageShift));
   491 									currentCacheSize >> gPageShift));
   490 		}
   492 		}
   491 
   493 
       
   494 	// Get the memory model of the kernel that this test is running on.
       
   495 	gMemModel = MemModelType();
   492 	return KErrNone;
   496 	return KErrNone;
   493 	}
   497 	}
   494 
   498 
   495 
   499 
   496 // 
   500 // 
  1534 		test.Printf(_L("No in use RAM zones found????\n"));
  1538 		test.Printf(_L("No in use RAM zones found????\n"));
  1535 		return KErrNotFound;
  1539 		return KErrNotFound;
  1536 		}
  1540 		}
  1537 
  1541 
  1538 	if (totalMorePrefInUse > requiredMovDis)
  1542 	if (totalMorePrefInUse > requiredMovDis)
  1539 		{// There enough allocatable pages in the RAM zones below the currently 
  1543 		{// There are enough allocatable pages in the RAM zones below the currently 
  1540 		// least preferable RAM in use.
  1544 		// least preferable RAM in use.
  1541 		test.Printf(_L("Memory is spread out totalMorePref 0x%x required 0x%x\n"), totalMorePrefInUse, requiredMovDis);
  1545 		test.Printf(_L("Memory is spread out totalMorePref 0x%x required 0x%x\n"), totalMorePrefInUse, requiredMovDis);
  1542 		if (verifySpread)
  1546 		if (verifySpread)
  1543 			return KErrGeneral;
  1547 			return KErrGeneral;
  1544 		}
  1548 		}
  9382 	Ldd2.FreeAllFixedPages();
  9386 	Ldd2.FreeAllFixedPages();
  9383 	TestEnd();
  9387 	TestEnd();
  9384 
  9388 
  9385 	test.Next(_L("Test5: Filling the FS Cache and allocating more than 16 contiguous fixed pages"));	
  9389 	test.Next(_L("Test5: Filling the FS Cache and allocating more than 16 contiguous fixed pages"));	
  9386 	TestStart();
  9390 	TestStart();
       
  9391 
       
  9392 	if (gMemModel >= EMemModelTypeFlexible)
       
  9393 		{// The flexible memory model won't flush the whole paging cache for 
       
  9394 		// contiguous allocations >16 pages so skip the next test.
       
  9395 		test.Printf(_L("This memory model won't flush the cache - Skipping...\n"));
       
  9396 		goto SkipTest5;
       
  9397 		}
       
  9398 
  9387 	// TestEnd() will have reduced any cache pages to minimum so just get current 
  9399 	// TestEnd() will have reduced any cache pages to minimum so just get current 
  9388 	// count of discardable pages.
  9400 	// count of discardable pages.
  9389 	GetAllPageInfo();
  9401 	GetAllPageInfo();
  9390 	minDiscardPages = gTotalPageCount.iDiscardablePages;
  9402 	minDiscardPages = gTotalPageCount.iDiscardablePages;
  9391 	
  9403