| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | |
| 4 | online_governors() { |
| 5 | FOUND="" |
| 6 | for cpu in "/sys/devices/system/cpu/cpu"[0-9]* ; do |
| 7 | if grep -vq '^1$' "$cpu/online" 2>/dev/null; then |
| 8 | continue |
| 9 | fi |
| 10 | if [ ! -e "$cpu/cpufreq" ]; then |
| 11 | continue |
| 12 | fi |
| 13 | cat "$cpu/cpufreq/scaling_governor" |
| 14 | FOUND=1 |
| 15 | done |
| 16 | if [ -z "$FOUND" ]; then |
| 17 | echo "nocpufreq_support" |
| 18 | fi |
| 19 | } |
| 20 | |
| 21 | # hostname is not on arch |
| 22 | if command -v hostname >/dev/null 2>/dev/null; then |
| 23 | printf "$(hostname)" |
| 24 | elif command -v hostnamectl >/dev/null 2>/dev/null; then |
| 25 | printf "$(hostnamectl --static)" |
| 26 | else |
| 27 | printf "unknown_host" |
| 28 | fi |
| 29 | printf - |
| 30 | if ls /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list >/dev/null 2>/dev/null; then |
| 31 | grep -q '[^0-9]' /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list && printf ht || printf noht |
| 32 | else |
| 33 | printf unknown_ht |
| 34 | fi |
| 35 | printf - |
| 36 | if [ -f /sys/devices/system/cpu/intel_pstate/no_turbo ]; then |
| 37 | grep -q 1 /sys/devices/system/cpu/intel_pstate/no_turbo && printf notb || printf tb |
| 38 | else |
| 39 | printf notb_support |
| 40 | fi |
| 41 | printf - |
| 42 | if [ -f /sys/class/power_supply/AC/online ]; then |
| 43 | grep -q 1 /sys/class/power_supply/AC/online && printf ac || printf noac |
| 44 | else |
| 45 | printf nops |
| 46 | fi |
| 47 | printf - |
| 48 | printf "$(printf "%s" "$(online_governors | uniq)" | tr '\n' '_')" |
| 49 | printf - |
| 50 | printf "$(gcc -march=native -Q --help=target | grep -v 'Known valid arguments' | grep march | cut -d= -f2 | grep -ow '\S*')" |
| 51 | printf '\n' |