aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2018-12-09 13:38:50 +0100
committerDavid Runge <dave@sleepmap.de>2018-12-09 13:38:50 +0100
commit99f06a2e3c2b6e040895ac7fe5963ae7ba8298d5 (patch)
tree982437807669e6d7d756133ba87d0f286529d021
parente23ba59267423a3ca67747dcdfd8884c9d5f7de8 (diff)
downloaddotfiles-99f06a2e3c2b6e040895ac7fe5963ae7ba8298d5.tar.gz
dotfiles-99f06a2e3c2b6e040895ac7fe5963ae7ba8298d5.tar.bz2
dotfiles-99f06a2e3c2b6e040895ac7fe5963ae7ba8298d5.tar.xz
dotfiles-99f06a2e3c2b6e040895ac7fe5963ae7ba8298d5.zip
bin/realtime-suggestions: Guarding against non-existing cpufreq dir in /sys, when running check_cpu_governor().
Mentioning default value in check_max_user_watches().
-rwxr-xr-xbin/realtime-suggestions23
1 files changed, 14 insertions, 9 deletions
diff --git a/bin/realtime-suggestions b/bin/realtime-suggestions
index c5e7355..9235651 100755
--- a/bin/realtime-suggestions
+++ b/bin/realtime-suggestions
@@ -97,23 +97,28 @@ check_max_user_watches() {
local minimum=524288
local proc_file="/proc/sys/fs/inotify/max_user_watches"
if [ "$(cat "$proc_file")" -lt $minimum ]; then
- echo "$change Consider increasing 'fs.inotify.max_user_watches>$minimum' - the maximum amount of files inotify can watch $sysctl_ref"
+ echo "$change Consider increasing 'fs.inotify.max_user_watches>$minimum' (default) - the maximum amount of files inotify can watch $sysctl_ref."
fi
}
check_cpu_governor() {
+ local governor_dir="/sys/devices/system/cpu/cpufreq/"
local cpupower_ref="(see \`man cpupower\` for reference)"
local governor=""
local policy_no=""
local cpu_no=""
- for governor_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor; do
- governor="$(cat "$governor_file")"
- policy_no="$(echo "$governor_file"| cut -d'/' -f7)"
- cpu_no="${policy_no//policy}"
- if [[ "$governor" != "performance" ]]; then
- echo "$change CPU $cpu_no has governor $governor set. Set it to 'performance' $cpupower_ref."
- fi
- done
+ if [ -d "${governor_dir}" ]; then
+ for governor_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor; do
+ governor="$(cat "$governor_file")"
+ policy_no="$(echo "$governor_file"| cut -d'/' -f7)"
+ cpu_no="${policy_no//policy}"
+ if [[ "$governor" != "performance" ]]; then
+ echo "$change CPU $cpu_no has governor $governor set. Set it to 'performance' $cpupower_ref."
+ fi
+ done
+ else
+ echo "$warning Unable to detect any CPU governor on your machine. ${governor_dir} does not exist!"
+ fi
}
check_config_high_res_timers() {