Debian Codegraph @

etc/hyperthreading.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 set -eu
3
4 usagescip-shell shell shell-project 0.0.0 usage().() {
5 echoscip-shell system . . echo. "USAGE: $0 <on|off>" ; exit 111
6 }
7
8 if [scip-shell system . . `[`. "$#" -eq 0 ]; then
9 usagescip-shell shell shell-project 0.0.0 usage().
10 fi
11
12 case $1 in
13 on)
14 for f in "/sys/devices/system/cpu/cpu"[0-9]*/online; do
15 echoscip-shell system . . echo. 1 > "$f"
16 done
17 ;;
18 off)
19 cores=""
20 for cpu in "/sys/devices/system/cpu/cpu"[0-9]* ; do
21 if grepscip-shell system . . grep. -vq '^1$' "$cpu/online" 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then
22 continue
23 fi
24 coreid=$(catscip-shell system . . cat. "$cpu/topology/core_id")
25 if echoscip-shell system . . echo. "$cores" | grepscip-shell system . . grep. -- "$coreid" ; then
26 echoscip-shell system . . echo. 0 > "$cpu/online"
27 fi
28 cores=$(printfscip-shell system . . printf. "$cores\n$coreid")
29 done
30 ;;
31 *) usagescip-shell shell shell-project 0.0.0 usage().
32 esac