Skip to content

Commit

Permalink
x86_energy_perf_policy: detect unsupported CPUs in newer versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
linrunner committed Apr 28, 2019
1 parent 4e398ac commit ce7e243
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
5 changes: 3 additions & 2 deletions changelog
Expand Up @@ -13,8 +13,9 @@
- Fix type determination
Operation Mode:
- MacBookPro 5.3: circumvent false AC offline status
Processor:
- tlp-stat -p: fix read of /sys/devices/system/cpu/cpufreq/boost
Processor, tlp-stat -p:
- Fix read of /sys/devices/system/cpu/cpufreq/boost
- x86_energy_perf_policy: detect unsupported CPUs in newer versions
Radio Devices:
- Issue #404: make RESTORE_DEVICE_STATE_ON_STARTUP=1 persistent again

Expand Down
39 changes: 22 additions & 17 deletions tlp-stat.in
Expand Up @@ -403,27 +403,32 @@ if [ "$show_proc" = "1" ] || [ "$show_all" = "1" ]; then
# --- show x86 energy perf policy info
if cmd_exists $ENERGYPERF; then
# check CPU support
$ENERGYPERF -r > /dev/null 2>&1
eperf=$($ENERGYPERF -r 2> /dev/null)
case $? in
0) # parse x86_energy_perf_policy output:
# - replace numbers with descriptive strings
# - remove ":"
# - indent and align
$ENERGYPERF -r 2>/dev/null | grep -v 'HWP_' | \
sed -r 's/://;
s/(0x0000000000000000|EPB 0)/performance/;
s/(0x0000000000000004|EPB 4)/balance-performance/;
s/(0x0000000000000006|EPB 6)/default/;
s/(0x0000000000000008|EPB 8)/balance-power/;
s/(0x000000000000000f|EPB 15)/power/' | \
awk '{ printf "x86_energy_perf_policy.%-31s = %s %s\n", $1, $2, $3; }'
0) if [ -n "$eperf" ]; then
# parse x86_energy_perf_policy output:
# - replace numbers with descriptive strings
# - remove ":"
# - indent and align
$ENERGYPERF -r 2>/dev/null | grep -v 'HWP_' | \
sed -r 's/://;
s/(0x0000000000000000|EPB 0)/performance/;
s/(0x0000000000000004|EPB 4)/balance-performance/;
s/(0x0000000000000006|EPB 6)/default/;
s/(0x0000000000000008|EPB 8)/balance-power/;
s/(0x000000000000000f|EPB 15)/power/' | \
awk '{ printf "x86_energy_perf_policy.%-31s = %s %s\n", $1, $2, $3; }'
printf "\n"
else
# newer versions produce zero output for unsupported CPUs
printf "x86_energy_perf_policy: unsupported CPU.\n\n"
fi
;;

1) echo "x86_energy_perf_policy: unsupported CPU." ;;
2) echo "x86_energy_perf_policy: program for your kernel not installed." ;;
*) echo "x86_energy_perf_policy: not available." ;;
1) printf "x86_energy_perf_policy: unsupported CPU.\n\n" ;;
2) printf "x86_energy_perf_policy: program for your kernel not installed.\n\n" ;;
*) printf "x86_energy_perf_policy: not available.\n\n" ;;
esac
echo
else
echo "x86_energy_perf_policy: program not installed."
echo
Expand Down

0 comments on commit ce7e243

Please sign in to comment.