github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/client/lib/resources/pid.go (about) 1 package resources 2 3 import ( 4 "github.com/hashicorp/nomad/client/stats" 5 ) 6 7 // PIDs holds all of a task's pids and their cpu percentage calculators 8 type PIDs map[int]*PID 9 10 // PID holds one task's pid and it's cpu percentage calculator 11 type PID struct { 12 PID int 13 StatsTotalCPU *stats.CpuStats 14 StatsUserCPU *stats.CpuStats 15 StatsSysCPU *stats.CpuStats 16 } 17 18 func NewPID(pid int) *PID { 19 return &PID{ 20 PID: pid, 21 StatsTotalCPU: stats.NewCpuStats(), 22 StatsUserCPU: stats.NewCpuStats(), 23 StatsSysCPU: stats.NewCpuStats(), 24 } 25 }