Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/cpu_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class IntelCPUConfig < CPUConfig
def disable_turbo_boost
# sudo requires the flag '-S' in order to take input from stdin
BenchmarkRunner.check_call("sudo -S sh -c 'echo #{TURBO_DISABLED_VALUE} > #{NO_TURBO_PATH}'")
at_exit { BenchmarkRunner.check_call("sudo -S sh -c 'echo 0 > #{NO_TURBO_PATH}'", quiet: true) }
at_exit { BenchmarkRunner.check_call("sudo --non-interactive sh -c 'echo 0 > #{NO_TURBO_PATH}'", quiet: true) }
end

def maximize_frequency
Expand Down Expand Up @@ -114,7 +114,7 @@ class AMDCPUConfig < CPUConfig
def disable_turbo_boost
# sudo requires the flag '-S' in order to take input from stdin
BenchmarkRunner.check_call("sudo -S sh -c 'echo #{TURBO_DISABLED_VALUE} > #{BOOST_PATH}'")
at_exit { BenchmarkRunner.check_call("sudo -S sh -c 'echo #{TURBO_ENABLED_VALUE} > #{BOOST_PATH}'", quiet: true) }
at_exit { BenchmarkRunner.check_call("sudo --non-interactive sh -c 'echo #{TURBO_ENABLED_VALUE} > #{BOOST_PATH}'", quiet: true) }
end

def maximize_frequency
Expand Down
4 changes: 2 additions & 2 deletions test/cpu_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
end

assert_equal 1, cleanup_commands.length, "at_exit block should call check_call once"
assert_equal "sudo -S sh -c 'echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'", cleanup_commands[0][:cmd]
assert_equal "sudo --non-interactive sh -c 'echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'", cleanup_commands[0][:cmd]
assert_equal({ quiet: true }, cleanup_commands[0][:opts])
end

Expand Down Expand Up @@ -298,7 +298,7 @@
end

assert_equal 1, cleanup_commands.length, "at_exit block should call check_call once"
assert_equal "sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/cpufreq/boost'", cleanup_commands[0][:cmd]
assert_equal "sudo --non-interactive sh -c 'echo 1 > /sys/devices/system/cpu/cpufreq/boost'", cleanup_commands[0][:cmd]
assert_equal({ quiet: true }, cleanup_commands[0][:opts])
end

Expand Down
Loading