Hardware counts CPUs, cores and threads per CPU. Top groups threads under a row per socket, reads each core's temperature from its own socket's coretemp chip, and the CPU temperature is the hotter package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
491 B
Go
17 lines
491 B
Go
package metrics
|
|
|
|
import "testing"
|
|
|
|
// a two-socket board: two coretemp chips, and the CPU's temperature is the hotter package
|
|
func TestCPUTempHottestPackage(t *testing.T) {
|
|
temps := []Temp{
|
|
{Chip: "coretemp", Label: "Core 0", C: 31},
|
|
{Chip: "coretemp", Label: "Core 0", C: 44, Pkg: 1},
|
|
{Chip: "coretemp", Label: "Package id 0", C: 35},
|
|
{Chip: "coretemp", Label: "Package id 1", C: 41, Pkg: 1},
|
|
}
|
|
if got := cpuTemp(temps); got != 41 {
|
|
t.Fatalf("cpuTemp = %v, want 41", got)
|
|
}
|
|
}
|