RedFlag/agent/internal/system/process.go
Fimeg 67e26be2d9 projection: begin the exact-path public epoch
The public tree and its history contain only the listed paths. Earlier projection history remains preserved internally.

Source-Sha: 913fde029b935671833254797f0f20f1eb9fabba

Policy-Sha: 913fde029b935671833254797f0f20f1eb9fabba

Tree-Digest: 180ae530c1058a2a5c89837bdce2d323ae83e669e38590ca72e75b8d92b7262f
2026-09-08 21:59:33 -04:00

21 lines
810 B
Go

package system
// TopProcess represents a single process snapshot for the dashboard's
// "Top Processes" table. Fields map directly to the UI columns:
// Name, PID, CPU%, Mem%.
type TopProcess struct {
Name string `json:"name"`
PID int `json:"pid"`
CPU float64 `json:"cpu"` // percent of total CPU time
Mem float64 `json:"mem"` // percent of total physical memory
}
// GetTopProcesses returns the top N processes sorted by CPU usage descending.
// Platform-specific implementations live in process_linux.go, process_windows.go,
// process_darwin.go.
//
// This is a snapshot primitive — no sampling interval, no background goroutine.
// The caller (loop.go) decides when to invoke it and at what cadence.
func GetTopProcesses(limit int) ([]TopProcess, error) {
return getTopProcesses(limit)
}