TInt E32Main() { test.Title(); test.Start(_L("Writable Data Paging Soak Test")); ParseCommandLine(); if (DPTest::Attributes() & DPTest::ERomPaging) test.Printf(_L("Rom paging supported\n")); if (DPTest::Attributes() & DPTest::ECodePaging) test.Printf(_L("Code paging supported\n")); if (DPTest::Attributes() & DPTest::EDataPaging) test.Printf(_L("Data paging supported\n")); TInt totalRamSize; HAL::Get(HAL::EMemoryRAM,totalRamSize); HAL::Get(HAL::EMemoryPageSize,gPageSize); test.Printf(_L("Total RAM size 0x%08X bytes"),totalRamSize); test.Printf(_L(" Swap size 0x%08X bytes"),SwapSize()); test.Printf(_L(" Page size 0x%08X bytes\n"),gPageSize); CacheSize(gMin,gMax); if ((DPTest::Attributes() & DPTest::EDataPaging) == 0) { test.Printf(_L("Writable Demand Paging not supported\n")); test.End(); return 0; } ShowMemoryUse(); //User::SetDebugMask(0x00000008); //KMMU //User::SetDebugMask(0x00000080); //KEXEC //User::SetDebugMask(0x90000000); //KPANIC KMMU2 //User::SetDebugMask(0x40000000, 1); //KPAGING if (gChunkSize) { CreateChunk (&gChunk[gNextChunk], gChunkSize); ReadChunk (&gChunk[gNextChunk]); ShowMemoryUse(); gNextChunk++; } CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler(); CActiveScheduler::Install(myScheduler); CActiveConsole* myActiveConsole = new CActiveConsole(); myActiveConsole->GetCharacter(); CActiveScheduler::Start(); test.End(); return 0; }
void CActiveConsole::ProcessValue() { switch (iCmdGetValue) { case 'C' : if (iValue > 0 && gNextChunk < MAX_CHUNKS) { CreateChunk (&gChunk[gNextChunk], iValue); ReadChunk (&gChunk[gNextChunk]); ShowMemoryUse(); gNextChunk++; } break; case 'H' : CacheSize (0,iValue); break; case 'L' : CacheSize (iValue,0); break; case 'P' : iPeriod = iValue; iActions = (TUint16)(iValue < KFlushQuietLimit ? EFlushQuiet : EFlush); iTimer->Cancel(); if (iValue > 0) { iTimer->Start(0,iValue,TCallBack(Callback,this)); } break; default : break; } iCmdGetValue = 0; iPrompt = ETrue; }
// public: RESULT C_CACHE::CacheOpen(int cacheSize) /* reserveerib m�lu */ { int n=0; char *ptr; RESULT res; if((res=CacheSize(cacheSize))!= ALL_RIGHT) { return res; } cBuf = new char[CACHE_SIZE*DBSIZE]; ptr = cBuf; // viit puhvrile for(n = 0; n < CACHE_SIZE; n++) { cache[n].index = VABA; // puhver t�hi cache[n].buffer = ptr; // viit puhvrile ptr += DBSIZE; } return ALL_RIGHT; }
// public: RESULT C_CACHE::CacheOpen(int cacheSize) /* reserveerib m�lu */ { int n=0; char *ptr; RESULT res; if((res=CacheSize(cacheSize))!= ALL_RIGHT) { return res; } cBuf = new char[N_BUFFERS*DBSIZE]; for(n = 0; n < CACHE_SIZE; n++) { cash[n] = NULL; // H�sh-tabelis pole �htegi puhvrit. } sBuf[0].chn_prev = sBuf+N_BUFFERS-1; // esimesele eelneb viimane sBuf[0].index = VABA; // puhver t�hi sBuf[0].hsh_next = sBuf[0].hsh_prev = NULL; sBuf[0].buffer = ptr = cBuf; // viit puhvrile ptr += DBSIZE; for(n = 1; n < N_BUFFERS; n++) { sBuf[n-1].chn_next = sBuf+n; sBuf[n].chn_prev = sBuf+n-1; sBuf[n].index = VABA; // puhver t�hi sBuf[n].hsh_next = sBuf[n].hsh_prev = NULL; sBuf[n].buffer = ptr; // viit puhvrile ptr += DBSIZE; } sBuf[N_BUFFERS-1].chn_next = sBuf; // viimasele j�rgneb esimene chnLst=sBuf; return ALL_RIGHT; }
void CActiveConsole::ProcessKeyPressL(TChar aChar) { if (aChar == EKeyEscape) { PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n")); CActiveScheduler::Stop(); return; } aChar.UpperCase(); if (iCmdGetValue != 0 && aChar == '\r') { if (iLastChar == 'K') { iValue *= iGetHexValue ? 0x400 : 1000; } if (iLastChar == 'M') { iValue *= iGetHexValue ? 0x10000 : 1000000; } PRINT1(_L("CActiveConsole: Value %d\n"),iValue); ProcessValue(); } if (iCmdGetValue != 0 ) { if (iGetHexValue) { if (aChar.IsDigit()) { iValue = iValue * 16 + aChar.GetNumericValue(); } else { if (aChar.IsHexDigit()) { iValue = iValue * 16 + (TUint)aChar - 'A' + 10; } else { if (aChar != 'K' && aChar != 'M') { PRINT(_L("Illegal hexadecimal character - Enter command\n")); iCmdGetValue = 0; } } } } else { if (aChar.IsDigit()) { iValue = iValue * 10 + aChar.GetNumericValue(); } else { if ((aChar == 'X') && (iLastChar == '0') && (iValue == 0)) iGetHexValue = ETrue; else { if (aChar != 'K' && aChar != 'M') { test.Printf(_L("Illegal decimal character - Enter command\n")); iCmdGetValue = 0; } } } } } else { switch (aChar) { case 'F' : TESTNEXT(_L("Flushing Cache")); test_KErrNone(DPTest::FlushCache()); ShowMemoryUse(); iPrompt = ETrue; break; case 'I' : CacheSize(0,0); ShowMemoryUse(); iPrompt = ETrue; break; case 'Q' : gQuiet = ETrue; iPrompt = ETrue; break; case 'V' : gQuiet = EFalse; iPrompt = ETrue; break; case '?' : ShowHelp(); break; case '=' : iCmdGetValue = iLastChar; iGetHexValue = EFalse; iValue = 0; break; default : if (aChar.IsDigit()) { if (iLastChar == 'R') { if (aChar.GetNumericValue() < (TInt)gNextChunk) { ReadChunk (&gChunk[aChar.GetNumericValue()]); } else { for (TUint i = 0; i < gNextChunk; i++) ReadChunk (&gChunk[i]); } iPrompt = ETrue; } if (iLastChar == 'W') { if (aChar.GetNumericValue() < (TInt)gNextChunk) { WriteChunk (&gChunk[aChar.GetNumericValue()]); } else { for (TUint i = 0; i < gNextChunk; i++) WriteChunk (&gChunk[i]); } iPrompt = ETrue; } if (iLastChar == 'M') { if (aChar.GetNumericValue() == 0) { iActions = (TUint16)(iPeriod < KFlushQuietLimit ? EFlushQuiet : EFlush); } else { iActions = (TUint16)(aChar.GetNumericValue() << 4); } iPrompt = ETrue; } } break; } } iLastChar = aChar; GetCharacter(); return; }