From 158bffa61f4c90f523d484287b3174bb1e16de7f Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Thu, 26 Sep 2019 12:30:10 -0500 Subject: [PATCH] always change CPU turbo state --- tools/perfect.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perfect.cpp b/tools/perfect.cpp index 6ab9d96..81e51fd 100644 --- a/tools/perfect.cpp +++ b/tools/perfect.cpp @@ -154,10 +154,13 @@ int main(int argc, char **argv) { // handle CPU turbo perfect::CpuTurboState cpuTurboState; + PERFECT(perfect::get_cpu_turbo_state(&cpuTurboState)); if (!cpuTurbo) { std::cerr << "disabling cpu turbo\n"; - PERFECT(perfect::get_cpu_turbo_state(&cpuTurboState)); PERFECT(perfect::disable_cpu_turbo()); + } else { + std::cerr << "enabling cpu turbo\n"; + PERFECT(perfect::enable_cpu_turbo()); } // handle governor @@ -193,10 +196,8 @@ int main(int argc, char **argv) { } // restore original turbo state - if (!cpuTurbo) { std::cerr << "restore CPU turbo\n"; PERFECT(perfect::set_cpu_turbo_state(cpuTurboState)); - } if (maxOsPerf) { std::cerr << "restore os performance state\n";