testsAndMisc/linux_configuration/scripts
Krzysztof kuhy Rudnicki c8c727e9d5 i3blocks: eliminate fork-storm with persist mode + zero-fork sysfs reads
Resource-usage report showed ~29 cores of average load coming from i3blocks
helper scripts forking awk/tr/grep/bc/sensors/nvidia-smi every tick. Rewrite
all five hot-path scripts to eliminate forks:

- volume.sh: persist mode, blocks on 'pactl subscribe' event stream.
  No polling, no sleep, no fork per tick.
- gpu_monitor.sh: persist mode, single long-lived 'nvidia-smi --loop=5'
  feeds a bash 'while read' loop. Falls back to /sys for amdgpu.
- battery_status.sh: reads /sys/class/power_supply/BAT*/ directly.
  Zero forks; replaces 'acpi | awk' pipeline.
- cpu_monitor.sh: reads /proc/loadavg and k10temp/coretemp /sys/class/hwmon.
  Zero forks; replaces 'sensors | awk | tr' + bc arithmetic.
- motherboard_temp.sh: reads nct*/it*/f71* Super-I/O hwmon node directly.
  Zero forks.

Configure volume + gpu_monitor with interval=persist so i3blocks keeps
one long-lived producer each instead of forking per tick.

Also add:
- kill_stale_recorders.sh -- kill stray ffmpeg x11grab / dotnet-trace /
  dotnet-monitor processes left running after sessions.
- monitors.slice -- resource-capped user slice (CPUQuota=50%,
  MemoryMax=512M, MemorySwapMax=0 for zram safety, TasksMax=256) to
  bound future monitoring regressions.
- efficient-polling-scripts SKILL -- rules for writing status-bar and
  polling scripts without forks; fork-pipeline to bash-builtin translation
  table; verification checklist.

Verified live: strace -c on cpu_monitor.sh shows 1 execve / 0 clones;
persist producers (pactl subscribe, nvidia-smi --loop) show 0 CPU ticks
over a 3s idle sample. Per-invocation timing 1.6-1.9 ms (was 30-80 ms).
2026-04-20 21:54:29 +02:00
..
digital_wellbeing Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
features feat: great beautiful fixes 2026-02-20 01:17:53 +01:00
fixes Merge branch 'main' of https://github.com/kuhyx/testsAndMisc 2026-03-12 08:50:22 +01:00
lib feat: great beautiful fixes 2026-02-20 01:17:53 +01:00
meta Add 'linux_configuration/' from commit '0762e3d07b90bac9256eb272de10bf9f42878094' 2026-02-06 21:43:26 +01:00
misc/testsAndMisc-bash chore: optimize pre-commit, remove tracked binaries, fix lint issues 2026-04-10 18:48:37 +02:00
system-maintenance i3blocks: eliminate fork-storm with persist mode + zero-fork sysfs reads 2026-04-20 21:54:29 +02:00
utils chore: optimize pre-commit, remove tracked binaries, fix lint issues 2026-04-10 18:48:37 +02:00
check_and_enable_services.sh feat: better screen lock checker 2026-03-08 21:39:39 +01:00
install_code_insiders.sh feat: install code insiders fix ubuntu performance gif to square and upgrae ubuntu script 2026-03-11 08:51:32 +01:00
install_joplin.sh pre commit fixes 2026-02-20 00:21:41 +01:00
setup_periodic_system.sh feat: periodic system installation 2026-03-28 14:38:32 +01:00
setup_thorium_startup.sh feat: great beautiful fixes 2026-02-20 01:17:53 +01:00
test_bad.sh feat: great beautiful fixes 2026-02-20 01:17:53 +01:00
test_removal.sh feat: great beautiful fixes 2026-02-20 01:17:53 +01:00