Files
nomad/client/lib/resources/pid.go
Patric Stout e190eae395 Use config "cpu_total_compute" (if set) for all CPU statistics (#17628)
Before this commit, it was only used for fingerprinting, but not
for CPU stats on nodes or tasks. This meant that if the
auto-detection failed, setting the cpu_total_compute didn't resolved
the issue.

This issue was most noticeable on ARM64, as there auto-detection
always failed.
2023-07-19 13:30:47 -05:00

29 lines
619 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package resources
import (
"github.com/hashicorp/nomad/helper/stats"
)
// PIDs holds all of a task's pids and their cpu percentage calculators
type PIDs map[int]*PID
// PID holds one task's pid and it's cpu percentage calculator
type PID struct {
PID int
StatsTotalCPU *stats.CpuStats
StatsUserCPU *stats.CpuStats
StatsSysCPU *stats.CpuStats
}
func NewPID(pid int) *PID {
return &PID{
PID: pid,
StatsTotalCPU: stats.NewCpuStats(),
StatsUserCPU: stats.NewCpuStats(),
StatsSysCPU: stats.NewCpuStats(),
}
}