tools/power/cpupower/cpupower-completion.sh

Source file repositories/reference/linux-study-clean/tools/power/cpupower/cpupower-completion.sh

File Facts

System
Linux kernel
Corpus path
tools/power/cpupower/cpupower-completion.sh
Extension
.sh
Size
3503 bytes
Lines
129
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

# -*- shell-script -*-
# bash completion script for cpupower
# Taken from git.git's completion script.

_cpupower_commands="frequency-info frequency-set idle-info idle-set set info monitor"

_frequency_info ()
{
	local flags="-f -w -l -d -p -g -a -s -y -o -m -n --freq --hwfreq --hwlimits --driver --policy --governors --related-cpus --affected-cpus --stats --latency --proc --human --no-rounding"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in
		frequency-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
	esac
}

_frequency_set ()
{
	local flags="-f -g --freq --governor -d --min -u --max -r --related"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in
		-f| --freq | -d | --min | -u | --max)
		if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
			COMPREPLY=($(compgen -W '$(cat $(ls -d /sys/devices/system/cpu/cpufreq/policy* | head -1)/scaling_available_frequencies)' -- "$cur"))
		fi ;;
		-g| --governor)
		if [ -d /sys/devices/system/cpu/cpufreq/ ] ; then
			COMPREPLY=($(compgen -W '$(cat $(ls -d /sys/devices/system/cpu/cpufreq/policy* | head -1)/scaling_available_governors)' -- "$cur"))
		fi;;
		frequency-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
	esac
}

_idle_info()
{
	local flags="-f --silent"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in
		idle-info) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
	esac
}

_idle_set()
{
	local flags="-d --disable -e --enable -D --disable-by-latency -E --enable-all"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in
		idle-set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
	esac
}

_set()
{
	local flags="--perf-bias, -b"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in
		set) COMPREPLY=($(compgen -W "$flags" -- "$cur")) ;;
	esac
}

_monitor()
{
	local flags="-l -m -i -c -v"
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	local cur="${COMP_WORDS[COMP_CWORD]}"
	case "$prev" in

Annotation

Implementation Notes