Files
AetherForge/agent/stats/reporter.go
drjones 6c42f2b600 Complete private Monero miner control stack.
Implement Windows agent with RandomX mining and WebSocket fleet reporting, wire dashboard settings into the builder with saved exe paths, and add project README.
2026-05-26 22:51:47 -07:00

36 lines
705 B
Go

package stats
import (
"os"
"runtime"
"strings"
)
type Reporter struct{}
func NewReporter() *Reporter {
return &Reporter{}
}
func (r *Reporter) SystemInfo() (hostname string, cpuCores int, memoryGB int) {
hostname, _ = os.Hostname()
cpuCores = runtime.NumCPU()
memoryGB = 8
return hostname, cpuCores, memoryGB
}
func (r *Reporter) Usage() (cpuPct float64, memPct float64) {
var m runtime.MemStats
runtime.ReadMemStats(&m)
memPct = float64(m.Alloc) / float64(m.Sys+1) * 100
if memPct > 100 {
memPct = 100
}
cpuPct = float64(runtime.NumGoroutine()) // placeholder; Windows perf counters are heavy
if cpuPct > 100 {
cpuPct = 100
}
_ = strings.TrimSpace("")
return cpuPct, memPct
}