A CPU burn testing tool with real-time hardware monitoring for Linux systems.
- CPU Burn Testing: Spawns configurable worker goroutines performing intensive floating-point operations
- Hardware Monitoring: Real-time CPU frequency, temperature, and fan speed tracking
- Two Display Modes:
- Line Mode: Simple text output with per-second statistics
- Graph Mode: Interactive TUI with live graphs and dynamic worker control
go build -o goburn# Run for 1 minute (line mode)
./goburn -duration=1m
# Run for 2 minutes with interactive TUI
./goburn -duration=2m -graph-duration: Test duration (default: 50s)-graph: Enable interactive TUI with graphs (default: false)
+or=: Increase worker count-or_: Decrease worker countqorCtrl+C: Quit
goburn/
├── main.go # Entry point and CLI
├── hardware/
│ └── stats.go # Hardware monitoring via Linux sysfs
├── worker/
│ └── pool.go # Dynamic worker pool management
├── ui/
│ ├── line.go # Simple line-based output
│ └── tui.go # Interactive TUI with graphs
├── go.mod
└── README.md
Responsible for reading system hardware metrics from Linux sysfs:
- CPU frequency from
/sys/devices/system/cpu/cpu*/cpufreq/ - Temperature from
/sys/class/thermal/and/sys/class/hwmon/ - Fan speeds from
/sys/class/hwmon/*/fan*_input
Key Functions:
Get(): Returns current hardware statistics- Thread-safe and efficient file reading
Manages a dynamic pool of CPU-intensive worker goroutines:
- Workers perform floating-point math operations (
math.Pow) - Can dynamically add/remove workers at runtime
- Updates
runtime.GOMAXPROCS()to match worker count - Uses channels for graceful worker shutdown
Key Types:
Pool: Manages worker lifecycle and shared counter
Key Methods:
New(counter, count): Create pool with initial workersSetWorkers(n): Dynamically adjust worker countGetActiveCount(): Get current worker count
Provides two user interface implementations:
- Prints one line per second with current metrics
- Format:
[elapsed] ops=XM/s | cpu=X/YMHz (Z%) | temp=X.XC | fans=X,YRPM - Non-interactive, suitable for logging
- Full-screen TUI using Bubble Tea
- 2x2 grid of real-time graphs:
- Operations per second
- CPU frequency percentage
- CPU temperature
- Average fan speed
- Graphs automatically scale to terminal size
- Y-axis starts at 0, scales to theoretical maximum
- 60-second rolling history window
Key Features:
- Responsive layout adapts to terminal resize
- Color-coded output using Lip Gloss
- ASCII graphs using asciigraph
- Add field to
hardware.Statsstruct inhardware/stats.go - Implement getter function (follow existing patterns)
- Call getter in
hardware.Get() - Update
ui/line.goto format new metric - Add graph in
ui/tui.goif desired
- Create new file in
ui/package - Implement
Run*Mode(counter, duration, startTime, ...)function - Add flag in
main.go - Call from
main()based on flag
Edit worker/pool.go:
runWorker(): Change CPU load algorithmSetWorkers(): Modify scaling behavior- Add new methods for worker control
- bubbletea: TUI framework
- lipgloss: Terminal styling
- asciigraph: ASCII graphs
Currently supports Linux only (requires sysfs for hardware monitoring).
- Each worker performs ~1 million operations before updating shared counter
- Atomic operations used for thread-safe counter updates
- Hardware stats read every second (I/O throttled)
- TUI updates at 1 Hz for smooth operation without excessive CPU usage
[Add your license here]