-
Notifications
You must be signed in to change notification settings - Fork 29
Extract CPU configuration logic into its own file #435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| def have_yjit?(ruby) | ||
| ruby_version = check_output("#{ruby} -v --yjit", err: File::NULL).strip | ||
| ruby_version = `#{ruby} -v --yjit 2> #{File::NULL}`.strip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not continue using check_output here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
popen is overkill. It is the same answer as the Process case. Ruby has Kernel#` to do what we want, get the stdout of a subshell. There is no reason to reimplement it using popen
| private | ||
|
|
||
| def disable_turbo_boost | ||
| # sudo requires the flag '-S' in order to take input from stdin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that it's always been like this but I don't know why we are using -S.
| end | ||
|
|
||
| def maximize_frequency | ||
| # Disabling Turbo Boost reduces the CPU frequency, so this should be run after that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this comment should actually go in disable_frequency_scaling since that's where the order is important.
| end | ||
|
|
||
| unless frequency_maximized? | ||
| puts("You forgot to set the min perf percentage to 100:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| puts("You forgot to set the min perf percentage to 100:") | |
| puts("You forgot to set the min perf percentage to #{FREQUENCY_MAXIMIZED_VALUE}:") |
And add tests for it.