ChuwiHi10Proに問題があります。 LinuxとWindowsで発生します。
画面の明るさが高すぎる場合、またはCPUが100%の場合、プラグを差し込んだ状態でバッテリーが消耗し始めます。 USB 3.0 QC充電器を使用すると非常にゆっくりと排出されますが、タブレットを24時間年中無休で確実に維持したいと考えています。
CPUを抑制し(電力管理)、高性能モードに戻るための簡単な方法、できればGUIまたは単純なBashスクリプトがあるかどうかを知りたいです。
Kodiなどのサービスに使用したい。少し絞れば、ビデオの再生を台無しにしないかもしれません。
バッテリー情報以外の副次的な質問ですが、ACアダプターからアンペア数とワット数を知る方法はありますか?
ベストアンサー
cpuf –CPUの最小/最大周波数を設定するためのシンプルなBashGUI
デモンストレーション
このデモでは、cpuf
ウィンドウは左側にあり、conky
システム情報は右側にあります。デモの進行状況は次のとおりです。
- YouTubeビデオがすでに実行されている間にデモが開始されます
- デフォルトのCPU最小/最大周波数は
800
です /3500
- CPUの最小/最大を
800
にオーバーライドします /800
CPU使用率は20%に跳ね上がります - CPUの最小/最大を
3500
にオーバーライドします /3500
CPU使用率は10%に低下します - デモがループバックして再開します
3台のモニターでcpuf
10フィート離れた場所に表示される可能性があるため、パラメータ1 --geometry
を使用します conky
の近くに配置するオプション :
sudo cpuf --geometry="450x450+4720+80" //eadn-wc01-5196795.nxedge.io/home/rick/Pictures/icons/cpu-intel-128.svg
- パラメータ1
--geometry
ウィンドウの幅x高さ+幅のオフセット+高さのオフセット - パラメータ2は独自のアイコン(この場合はIntel CPUイメージ)にすることができます。それ以外の場合は、デフォルトでコンピュータアイコンになります
cpuf
Bashスクリプト
このセクションでは、 Ctrlでターミナルを開く必要があります + Alt + T 。
設定方法
機能するには、cpuf
bashスクリプトに必要なもの:
sudo apt install yad # from the repository universe
sudo apt install coreutils # installed by default in most distros
cpuf
を配置するのが最も簡単です 検索パス内のルート所有ディレクトリにスクリプトを記述します。例:/usr/local/bin
。
cpuf
を作成するには スクリプトは、sudo -H gedit /usr/local/bin/cpuf
を使用してエディターを開きます 。
- 以下のセクションの行を強調表示します
- 右クリックして[コピー]を選択します
- 編集者に戻ります
- 右クリックして[貼り付け]を選択します
- エディタメニューから[保存]、[終了]の順に選択します
sudo chmod a+x /usr/local/bin/cpuf
を使用してスクリプトを実行可能にします 。
cpuf
エディターにコピーするコード
#!/bin/bash
# NAME: cpuf (Pronounced SEA-PUFF)
# CALL: sudo cpuf
# PARM: $1 = --geometry=WidthxHeight+VertOffset+HorizOffset
# $2 = Optional image icon
# DESC: Simple GUI script to set CPU Min and Max Frequency.
# For Ask Ubuntu Question: https://askubuntu.com/q/1141605/307523
# DATE: May 12, 2019.
# UPDT: No updates yet.
# NOTE: No notes yet.
### Dependancies ###
command -v yad >/dev/null 2>&1 || { echo >&2
"yad package required but it is not installed. Aborting.";
exit 1; }
command -v nproc >/dev/null 2>&1 || { echo >&2
"coreutils package required but it is not installed. Aborting.";
exit 2; }
if [[ $(id -u) != 0 ]]; then # root powers needed to call this script
echo >&2 Must be called with sudo powers
exit 3
fi
# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
notify-send --urgency=critical
"$0 cannot be run from GUI without TERM environment variable."
exit 4
fi
### Program constants ###
## Yad Window parameters
# Hard code Height & Width to suit your screen resolution and scaling factor
GEOMETRY="--width 400 --height 500"
# Pass Parameter 1 with ---geometry="WidxHgt+WidOff+HgtOff" to override
[[ "$1" == --geometry=* ]] && GEOMETRY="$1"
TITLE="cpuf"
TEXT="Set CPU Min/Max Frequencies"
ICON="//eadn-wc01-5196795.nxedge.io/usr/share/icons/Adwaita/48x48/devices/computer.png"
# Pass Parameter 2 with icon for window image
# Intel CPU comes from: https://www.gnome-look.org/p/1107932/
[[ ! -z "$2" ]] && ICON="$2"
## Virtual File System directories
CPU0_DIR=/sys/devices/system/cpu/cpu0/cpufreq
PSTATE_DIR=/sys/devices/system/cpu/intel_pstate
CURR_MIN_FREQ="$CPU0_DIR/scaling_min_freq"
CURR_MAX_FREQ="$CPU0_DIR/scaling_max_freq"
ALLOW_MIN_FREQ="$CPU0_DIR/cpuinfo_min_freq"
ALLOW_MAX_FREQ="$CPU0_DIR/cpuinfo_max_freq"
OLD_IFS=$IFS # Save current Input File Separtor (IFS)
declare -a Arr # Array for YAD Window input
NumCPU=$(nproc --all) # Number of CPUs (nproc from coreutils)
### Error Message Functions ###
Abend () {
# Abnormal Ending - Parameter 1 = message to display, Parameter 2=exit code
yad --image "dialog-error" --image-on-top --title "$TITLE - Fatal Error"
"$GEOMETRY" --button=gtk-ok:0 --text "$1" 2>/dev/null
exit "$2"
} # Abend
ErrMsg () {
# Parmater 1 = message to display
yad --image "dialog-error" --title "$TITLE - Logical Error"
"$GEOMETRY" --button=gtk-ok:0 --text "$1" 2>/dev/null
fErrMsgForceContinue=true
} # ErrMsg
### Initialize Variables ###
InitVars () {
[[ ! -e "$ALLOW_MIN_FREQ" ]] && Abend "$ALLOW_MIN_FREQ not found" 11
AllowMinFreq=$(cat "$ALLOW_MIN_FREQ")
AllowMinFreq="${AllowMinFreq::-3}" # Chop off three decimals at end
[[ ! -e "$ALLOW_MAX_FREQ" ]] && Abend "$ALLOW_MAX_FREQ not found" 12
AllowMaxFreq=$(cat "$ALLOW_MAX_FREQ")
AllowMaxFreq="${AllowMaxFreq::-3}"
[[ ! -e "$CURR_MIN_FREQ" ]] && Abend "$CURR_MIN_FREQ not found" 13
CurrMinFreq=$(cat "$CURR_MIN_FREQ")
CurrMinFreq="${CurrMinFreq::-3}"
NewMinFreq="$CurrMinFreq"
[[ ! -e "$CURR_MAX_FREQ" ]] && Abend "$CURR_MAX_FREQ not found" 14
CurrMaxFreq=$(cat "$CURR_MAX_FREQ")
CurrMaxFreq="${CurrMaxFreq::-3}"
NewMaxFreq="$CurrMaxFreq"
if [[ -e "$PSTATE_DIR" ]] ; then
NumPstates=$(cat "$PSTATE_DIR/num_pstates")
if [[ $(cat "$PSTATE_DIR/no_turbo") -eq 0 ]] ; then
TurboBoost="Enabled"
else
TurboBoost="Disabled"
fi
else
NumPstates="Not found"
TurboBoost="Not found"
fi
if [[ -e "$CPU0_DIR/scaling_governor" ]] ; then
Governor=$(cat "$CPU0_DIR/scaling_governor")
else
Governor="Not found"
fi
if [[ -e "$CPU0_DIR/scaling_cur_freq" ]] ; then
CurrFreq=$(cat "$CPU0_DIR/scaling_cur_freq")
# Chop off three decimals at end
CurrFreq="${CurrFreq::-3}"
else
CurrFreq="Not found"
fi
} # InitVars
### Paint / repaint window and get new frequencies ###
GetParameters () {
# +------------------------------------------+
# | cpuf - Set CPU Min/Max Frequencies |
# +------------------------------------------+
# | |
# | Turbo Boost: Enabled |
# | |
# | Number of pstates: 99 |
# | Speed Governor Used: powersave |
# | Current CPU0 frequency: 9999 Mhz |
# | |
# | Current Minimum Freq.: 9999 Mhz |
# | Current Maximum Freq.: 9999 Mhz |
# | |
# | New Minimum Frequency 9999 |
# | New Maximum Frequency 9999 |
# | |
# +------------------------------------------+
IFS="|"
Arr=($(yad "$GEOMETRY" --form
--title "$TITLE" --text "$TEXT"
--window-icon="$ICON" --image="$ICON"
--field="Turbo Boost:":RO "$TurboBoost"
--field="Number of pstates:":RO "$NumPstates"
--field="Speed Governor:":RO "$Governor"
--field="Current Frequency:":RO "$CurrFreq MHz"
--field="Allowable Minimum Frequency:":RO "$AllowMinFreq MHz"
--field="Allowable Maximum Frequency:":RO "$AllowMaxFreq MHz"
--field="Current Minimum Frequency:":RO "$CurrMinFreq MHz"
--field="Current Maximum Frequency:":RO "$CurrMaxFreq MHz"
--field="New Minimum Frequency" "$NewMinFreq"
--field="New Maximum Frequency" "$NewMaxFreq" 2>/dev/null))
Return="$?"
NewMinFreq="${Arr[8]}"
NewMaxFreq="${Arr[9]}"
} # GetParameters
###################################
# MAINLINE #
###################################
ALL_PREFIX="/sys/devices/system/cpu/cpu"
MIN_SUFFIX="/cpufreq/scaling_min_freq"
MAX_SUFFIX="/cpufreq/scaling_max_freq"
while true ; do
InitVars
GetParameters
[[ ! "$Return" -eq 0 ]] && break ; # Exit on Cancel=1 or Close Window=252
# Sanity checks
fErrMsgForceContinue=false
[[ $NewMinFreq -lt $AllowMinFreq ]] && ErrMsg "Minimum frequency too low"
[[ $NewMaxFreq -gt $AllowMaxFreq ]] && ErrMsg "Maximum frequency too high"
[[ $NewMinFreq -gt $NewMaxFreq ]] && ErrMsg "Minimum frequency greater than Maximum Frequency"
[[ $fErrMsgForceContinue == true ]] && continue
# Set new Min/Max frequencies
for (( i=0 ; i<NumCPU ; i++ )) ; do
# If New Min > Curr Max, set Max first then Min
if [[ $NewMinFreq -gt $CurrMaxFreq ]] ; then
echo "$NewMaxFreq""000" > "$ALL_PREFIX$i$MAX_SUFFIX"
echo "$NewMinFreq""000" > "$ALL_PREFIX$i$MIN_SUFFIX"
else
echo "$NewMinFreq""000" > "$ALL_PREFIX$i$MIN_SUFFIX"
echo "$NewMaxFreq""000" > "$ALL_PREFIX$i$MAX_SUFFIX"
fi
done
done
IFS="$OLD_IFS"
exit 0