mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1 to 1.16.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.15.1...v1.16.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
f815eb46fd
commit
5cf55eda72
32
vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
32
vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
@ -15,6 +15,7 @@ package procfs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -76,6 +77,9 @@ type ProcStatus struct {
|
||||
UIDs [4]string
|
||||
// GIDs of the process (Real, effective, saved set, and filesystem GIDs)
|
||||
GIDs [4]string
|
||||
|
||||
// CpusAllowedList: List of cpu cores processes are allowed to run on.
|
||||
CpusAllowedList []uint64
|
||||
}
|
||||
|
||||
// NewStatus returns the current status information of the process.
|
||||
@ -161,10 +165,38 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt
|
||||
s.VoluntaryCtxtSwitches = vUint
|
||||
case "nonvoluntary_ctxt_switches":
|
||||
s.NonVoluntaryCtxtSwitches = vUint
|
||||
case "Cpus_allowed_list":
|
||||
s.CpusAllowedList = calcCpusAllowedList(vString)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TotalCtxtSwitches returns the total context switch.
|
||||
func (s ProcStatus) TotalCtxtSwitches() uint64 {
|
||||
return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches
|
||||
}
|
||||
|
||||
func calcCpusAllowedList(cpuString string) []uint64 {
|
||||
s := strings.Split(cpuString, ",")
|
||||
|
||||
var g []uint64
|
||||
|
||||
for _, cpu := range s {
|
||||
// parse cpu ranges, example: 1-3=[1,2,3]
|
||||
if l := strings.Split(strings.TrimSpace(cpu), "-"); len(l) > 1 {
|
||||
startCPU, _ := strconv.ParseUint(l[0], 10, 64)
|
||||
endCPU, _ := strconv.ParseUint(l[1], 10, 64)
|
||||
|
||||
for i := startCPU; i <= endCPU; i++ {
|
||||
g = append(g, i)
|
||||
}
|
||||
} else if len(l) == 1 {
|
||||
cpu, _ := strconv.ParseUint(l[0], 10, 64)
|
||||
g = append(g, cpu)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sort.Slice(g, func(i, j int) bool { return g[i] < g[j] })
|
||||
return g
|
||||
}
|
||||
|
Reference in New Issue
Block a user