diff --git a/README.md b/README.md index d81be67d..4a744469 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Lastest release - Gnome 42 + Gnome 43 License diff --git a/metadata.json b/metadata.json index a5f4ee8f..c4f25b9d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,7 +1,7 @@ { "localedir": "/usr/local/share/locale", "shell-version": [ - "3.28", "3.30", "3.36", "3.38", "40", "41", "42" + "3.28", "3.30", "3.36", "3.38", "40", "41", "42", "43" ], "uuid": "cpupower@mko-sl.de", "name": "CPU Power Manager", diff --git a/src/indicator.js b/src/indicator.js index 573796f5..a6828aca 100644 --- a/src/indicator.js +++ b/src/indicator.js @@ -108,7 +108,12 @@ var CPUFreqIndicator = class CPUFreqIndicator extends baseindicator.CPUFreqBaseI } enable() { - this.power = Main.panel.statusArea["aggregateMenu"]._power; + if (parseFloat(Config.PACKAGE_VERSION.substring(0, 4)) >= 43) { + this.power = imports.ui.main.panel.statusArea.quickSettings._system._systemItem._powerToggle; + } else { + this.power = Main.panel.statusArea["aggregateMenu"]._power; + } + this.powerState = this.power._proxy.State; this.powerConnectSignalId = this.power._proxy.connect( "g-properties-changed", diff --git a/tool/cpufreqctl b/tool/cpufreqctl index 1ae96f2d..96806cd0 100755 --- a/tool/cpufreqctl +++ b/tool/cpufreqctl @@ -22,6 +22,7 @@ # along with this program. If not, see . set -o errexit -o nounset +renice -n 19 0 >/dev/null VERSION="10.1.2" PRODUCTION=yes @@ -93,6 +94,36 @@ not_supported () EXIT_CODE=9 } +# echo min/max/avg/rnd of a space-separated list of numbers +# $1 number of element +# $2 space-separated list of numbers +compute_min_max_avg_rnd () +{ + nb_measures=$1 + measures=$2 + max=0 + min=10000000 + tot=0 + idx=0 + rnd_id=$(shuf -i 0-$((nb_measures-1)) -n 1) + for i in $measures; do + tot=$((tot + i)) + if [ "$i" -gt "$max" ]; then + max=$i + fi + if [ "$i" -lt "$min" ]; then + min=$i + fi + if [ "$idx" -eq "$rnd_id" ]; then + rnd=$i + fi + idx=$((idx+1)) + done + avg=$((tot/nb_measures)) + + echo --min "${min}" --max "${max}" --avg "${avg}" --rnd "${rnd}" +} + fake_init () { FAKE_DIR=/tmp/cpufreqctl-fake-backend @@ -175,24 +206,9 @@ fake_info_frequencies () fake_info_current () { fake_init - - shuf -i 800000-3600000 -n 12 | sort -n | awk ' - BEGIN { - srand() - } - NR == 1 { - printf "%d ", $1 - } - { - sum += $1 - r[NR] = $1 - } - END { - printf "%d %.0f %d\n", $1, sum / NR, r[int(rand() * NR) + 1] - }' | while read -r min max avg rnd - do - report_info_current --min "${min}" --max "${max}" --avg "${avg}" --rnd "${rnd}" - done + measures=$(shuf -i 800000-3600000 -n 12) + num_cores=12 + report_info_current $(compute_min_max_avg_rnd "$num_cores" "$measures") } intel_pstate_supported () @@ -276,26 +292,9 @@ intel_pstate_info_frequencies () intel_pstate_info_current () { - for scaling_cur_freq in /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq - do - cat "${scaling_cur_freq}" & - done | sort -n | awk ' - BEGIN { - srand() - } - NR == 1 { - printf "%d ", $1 - } - { - sum += $1 - r[NR] = $1 - } - END { - printf "%d %.0f %d\n", $1, sum / NR, r[int(rand() * NR) + 1] - }' | while read -r min max avg rnd - do - report_info_current --min "${min}" --max "${max}" --avg "${avg}" --rnd "${rnd}" - done + measures=$(cat /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq) + num_cores=$(getconf _NPROCESSORS_ONLN) + report_info_current $(compute_min_max_avg_rnd "$num_cores" "$measures") } cpufreq_supported () @@ -472,26 +471,9 @@ cpufreq_info_frequencies () cpufreq_info_current () { - for scaling_cur_freq in /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq - do - cat "${scaling_cur_freq}" & - done | sort -n | awk ' - BEGIN { - srand() - } - NR == 1 { - printf "%d ", $1 - } - { - sum += $1 - r[NR] = $1 - } - END { - printf "%d %.0f %d\n", $1, sum / NR, r[int(rand() * NR) + 1] - }' | while read -r min max avg rnd - do - report_info_current --min "${min}" --max "${max}" --avg "${avg}" --rnd "${rnd}" - done + measures=$(cat /sys/devices/system/cpu/cpufreq/policy*/scaling_cur_freq) + num_cores=$(getconf _NPROCESSORS_ONLN) + report_info_current $(compute_min_max_avg_rnd "$num_cores" "$measures") } backend_select()