From bb43ad5def3e798eba6626b6c16f8a3089a21b9d Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Thu, 4 Jul 2024 11:03:26 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20remove=20performance=20menu=20wi?= =?UTF-8?q?th=20functions=20its=20using?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tui.cpp | 34 ---------------------------------- src/utils.cpp | 35 ----------------------------------- src/utils.hpp | 2 -- 3 files changed, 71 deletions(-) diff --git a/src/tui.cpp b/src/tui.cpp index b23f472..f718d91 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -780,40 +780,9 @@ void enable_autologin() { utils::enable_autologin(dm, autologin_user); } -void performance_menu() { - const std::vector menu_entries = { - "I/O Schedulers", - "Swap Configuration", - "Back", - }; - - auto screen = ScreenInteractive::Fullscreen(); - std::int32_t selected{}; - auto ok_callback = [&] { - switch (selected) { - case 0: - screen.Suspend(); - utils::set_schedulers(); - screen.Resume(); - break; - case 1: - screen.Suspend(); - utils::set_swappiness(); - screen.Resume(); - break; - default: - screen.ExitLoopClosure()(); - break; - } - }; - static constexpr auto tweaks_body = "Various configuration options"sv; - detail::menu_widget(menu_entries, ok_callback, &selected, &screen, tweaks_body, {.text_size = size(HEIGHT, GREATER_THAN, 1)}); -} - void tweaks_menu() noexcept { const std::vector menu_entries = { "Enable Automatic Login", - "Performance", "Back", }; @@ -824,9 +793,6 @@ void tweaks_menu() noexcept { case 0: tui::enable_autologin(); break; - case 1: - tui::performance_menu(); - break; default: screen.ExitLoopClosure()(); break; diff --git a/src/utils.cpp b/src/utils.cpp index b398c53..0751eb8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1770,41 +1770,6 @@ void enable_autologin([[maybe_unused]] const std::string_view& dm, [[maybe_unuse #endif } -void set_schedulers() noexcept { -#ifdef NDEVENV - static constexpr auto rules_path = "/mnt/etc/udev/rules.d/60-ioscheduler.rules"; - if (!fs::exists(rules_path)) { - static constexpr auto ioscheduler_rules = R"(# set scheduler for NVMe -ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none" -# set scheduler for SSD and eMMC -ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline" -# set scheduler for rotating disks -ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq")"; - std::ofstream rules{rules_path}; - rules << ioscheduler_rules; - } - gucc::utils::exec("vim /mnt/etc/udev/rules.d/60-ioscheduler.rules", true); -#else - gucc::utils::exec("vim /etc/udev/rules.d/60-ioscheduler.rules", true); -#endif -} - -void set_swappiness() noexcept { -#ifdef NDEVENV - static constexpr auto rules_path = "/mnt/etc/sysctl.d/99-sysctl.conf"; - if (!fs::exists(rules_path)) { - static constexpr auto sysctl_rules = R"(vm.swappiness = 10 -vm.vfs_cache_pressure = 50 -#vm.dirty_ratio = 3)"; - std::ofstream rules{rules_path}; - rules << sysctl_rules; - } - gucc::utils::exec("vim /mnt/etc/sysctl.d/99-sysctl.conf", true); -#else - gucc::utils::exec("vim /etc/sysctl.d/99-sysctl.conf", true); -#endif -} - bool parse_config() noexcept { using namespace rapidjson; diff --git a/src/utils.hpp b/src/utils.hpp index 3bf5e41..090d17b 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -66,8 +66,6 @@ void show_iwctl() noexcept; void set_keymap() noexcept; void enable_autologin(const std::string_view& dm, const std::string_view& user) noexcept; -void set_schedulers() noexcept; -void set_swappiness() noexcept; bool parse_config() noexcept; void setup_luks_keyfile() noexcept; void grub_mkconfig() noexcept;