The RAM Watcher is a continuous polling loop that reads virtual memory statistics from the operating system and prints total RAM, used RAM, and used RAM percentage to the terminal on each cycle. It is implemented in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/stratosphere-ve/core/llms.txt
Use this file to discover all available pages before exploring further.
ramwatcher package and uses the gopsutil library to access memory information in a cross-platform way.
What it does
On each iteration,WatchRAM() calls mem.VirtualMemory() to retrieve a snapshot of system memory. It converts the raw byte values for total and used RAM into gigabytes by dividing by 1024³, then prints all three values before sleeping for the configured polling duration.
Output format:
RAM byte values are converted to GB by dividing by 1,073,741,824 (1024³). The
UsedPercent field is taken directly from gopsutil and reflects the OS-reported usage ratio.Source code
ramwatcher/ramwatcher.go
CLI usage
Set the polling rate (optional)
Select option 3 from the menu. This sets the RAM polling rate to 2 seconds and immediately starts the watcher.
Example output
Polling rate
The default polling rate is 1 second, controlled by theramPollingRate variable. Unlike the CPU watcher — which passes the duration directly to cpu.Percent() — the RAM watcher uses time.Sleep(ramPollingRate) at the end of each loop iteration to introduce the delay.
Selecting CLI option 3 calls RAMSetPollingRate(2), which sets the rate to 2 seconds before starting the loop.
Functions
| Function | Description |
|---|---|
WatchRAM() | Starts the infinite RAM polling loop. Prints total GB, used GB, and used percent on each cycle. |
RAMSetPollingRate(rate float64) | Sets the polling interval in seconds. Accepts a float64 value (e.g. 2.0 for 2 seconds). |