mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 08:25:43 +03:00
* client: refactor cgroups management in client * client: fingerprint numa topology * client: plumb numa and cgroups changes to drivers * client: cleanup task resource accounting * client: numa client and config plumbing * lib: add a stack implementation * tools: remove ec2info tool * plugins: fixup testing for cgroups / numa changes * build: update makefile and package tests and cl
33 lines
586 B
Go
33 lines
586 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
//go:build linux
|
|
|
|
package procstats
|
|
|
|
import (
|
|
"github.com/hashicorp/go-set"
|
|
"github.com/hashicorp/nomad/client/lib/cgroupslib"
|
|
)
|
|
|
|
type Cgrouper interface {
|
|
Cgroup() string
|
|
}
|
|
|
|
func List(cg Cgrouper) *set.Set[ProcessID] {
|
|
cgroup := cg.Cgroup()
|
|
var ed cgroupslib.Interface
|
|
switch cgroupslib.GetMode() {
|
|
case cgroupslib.CG1:
|
|
ed = cgroupslib.OpenFromCpusetCG1(cgroup, "freezer")
|
|
default:
|
|
ed = cgroupslib.OpenPath(cgroup)
|
|
}
|
|
|
|
s, err := ed.PIDs()
|
|
if err != nil {
|
|
return set.New[ProcessID](0)
|
|
}
|
|
return s
|
|
}
|