resmon is a terminal resource monitor (CPU, RAM, per-core usage, clock
frequency, temps, GPU) I've been building in LuaJIT.
A few things that might interest this sub specifically:
- The whole app — main loop, layout, rendering — is LuaJIT, compiled with
`luajit -b` into bytecode headers and baked directly into the C host via
`package.preload`. End result is a single self-contained ELF binary with
no runtime Lua/LuaJIT dependency (glibc/libm stay dynamic since LuaJIT's
FFI needs dlsym-style resolution against a real glibc).
- All raw-mode terminal handling, /proc and sysfs reads, and process
spawning go through LuaJIT's FFI directly — no C helper functions beyond
a ~60-line host.c that just boots the Lua state.
- Data collection and rendering are split: "fetchers" pull from one data
source (a proc/sysfs file, or a piped subprocess like amdgpu_top) on
their own refresh interval and cache the result; any number of display
"modules" can read the same cached fetch without re-fetching. Both
fetchers and modules are plain .lua files, loaded from disk at startup
with loadfile() — you can drop in a custom one with zero recompilation,
same contract the built-in ones use.
Repo:
https://github.com/pacrox/resmonFeedbacks are welcome.