status_t Settings::WriteSwapSettings() { BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return B_ERROR; path.Append("kernel/drivers"); path.Append(kVirtualMemorySettings); BFile file; if (file.SetTo(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE) != B_OK) return B_ERROR; fs_info info; if (fs_stat_dev(SwapVolume(), &info) != 0) return B_ERROR; char buffer[1024]; snprintf(buffer, sizeof(buffer), "vm %s\nswap_auto %s\nswap_size %" B_PRIdOFF "\nswap_volume_name %s\nswap_volume_device %s\n" "swap_volume_filesystem %s\nswap_volume_capacity %" B_PRIdOFF "\n", SwapEnabled() ? "on" : "off", SwapAutomatic() ? "yes" : "no", SwapSize(), info.volume_name, info.device_name, info.fsh_name, info.total_blocks * info.block_size); file.Write(buffer, strlen(buffer)); return B_OK; }
bool Settings::IsDefaultable() { return SwapEnabled() != fDefaultSettings.enabled || SwapAutomatic() != fDefaultSettings.automatic || SwapSize() != fDefaultSettings.size || SwapVolume() != fDefaultSettings.volume; }
bool Settings::IsRevertable() { return SwapEnabled() != fInitialSettings.enabled || SwapAutomatic() != fInitialSettings.automatic || SwapSize() != fInitialSettings.size || SwapVolume() != fInitialSettings.volume; }
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 CAnimatedAlphaWindow::OnKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags ) { if (nChar == 'A') { SwapSize(); Update(); } if (nChar == ' ') { if (mCurrentDrawer == mD2DWICDrawer.get()) mCurrentDrawer = (IDrawer *)mGdiDrawer.get(); else mCurrentDrawer = (IDrawer *)mD2DWICDrawer.get(); Update(); } if (nChar == 'J' || nChar == 'K') { double newSweep = (nChar == 'K' ? mCurrentSweep + 15. : mCurrentSweep - 15.); AnimateSweepTo(newSweep); mCurrentSweep = newSweep; } }