mirror of
https://github.com/containerd/containerd.git
synced 2026-08-12 22:16:27 +00:00
build(deps): bump github.com/intel/goresctrl from 0.10.0 to 0.11.0
Bumps [github.com/intel/goresctrl](https://github.com/intel/goresctrl) from 0.10.0 to 0.11.0. - [Release notes](https://github.com/intel/goresctrl/releases) - [Commits](https://github.com/intel/goresctrl/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: github.com/intel/goresctrl dependency-version: 0.11.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
4
go.mod
4
go.mod
@@ -42,7 +42,7 @@ require (
|
||||
github.com/google/go-cmp v0.7.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0
|
||||
github.com/intel/goresctrl v0.10.0
|
||||
github.com/intel/goresctrl v0.11.0
|
||||
github.com/klauspost/compress v1.18.2
|
||||
github.com/mdlayher/vsock v1.2.1
|
||||
github.com/moby/locker v1.0.1
|
||||
@@ -130,7 +130,7 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.66.1 // indirect
|
||||
github.com/prometheus/procfs v0.16.1 // indirect
|
||||
github.com/prometheus/procfs v0.17.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sasha-s/go-deadlock v0.3.5 // indirect
|
||||
github.com/smallstep/pkcs7 v0.1.1 // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -187,8 +187,8 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/intel/goresctrl v0.10.0 h1:Q94PBhLtQM/aVxVTKzB1j/ooMuV+9XleTN1fq2OGsSo=
|
||||
github.com/intel/goresctrl v0.10.0/go.mod h1:1S8GDqL46GuKb525bxNhIEEkhf4rhVcbSf9DuKhp7mw=
|
||||
github.com/intel/goresctrl v0.11.0 h1:FnlyrQxgjp9nm2hccwvBDc7qmf9uLxKf0DC6CKobnMA=
|
||||
github.com/intel/goresctrl v0.11.0/go.mod h1:F6jINn5WKuXXHAjmE7eTBjeHPmqT2kiWStrggYIm+UM=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
|
||||
@@ -298,8 +298,8 @@ github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
|
||||
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
|
||||
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
|
||||
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
|
||||
194
vendor/github.com/intel/goresctrl/pkg/rdt/otel.go
generated
vendored
Normal file
194
vendor/github.com/intel/goresctrl/pkg/rdt/otel.go
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
Copyright 2025 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package rdt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
)
|
||||
|
||||
func RegisterOpenTelemetryInstruments(meter metric.Meter) error {
|
||||
for resource, features := range GetMonFeatures() {
|
||||
switch resource {
|
||||
case MonResourceL3:
|
||||
for _, f := range features {
|
||||
if err := registerInstrument(meter, f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func registerInstrument(meter metric.Meter, feature string) error {
|
||||
instr, err := createInstrument(meter, feature)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = meter.RegisterCallback(
|
||||
func(ctx context.Context, o metric.Observer) error {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return fmt.Errorf("rdt metric collection cancelled: %w", ctx.Err())
|
||||
default:
|
||||
observeInstrument(o, instr, feature)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
instr,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func createInstrument(meter metric.Meter, feature string) (metric.Int64Observable, error) {
|
||||
switch feature {
|
||||
case "llc_occupancy":
|
||||
name := "l3.llc.occupancy"
|
||||
help := "L3 (LLC) occupancy"
|
||||
return meter.Int64ObservableGauge(
|
||||
name,
|
||||
metric.WithDescription(help),
|
||||
)
|
||||
|
||||
case "mbm_local_bytes":
|
||||
name := "l3.mbm.local"
|
||||
help := "bytes transferred to/from local memory through LLC"
|
||||
unit := "bytes"
|
||||
return meter.Int64ObservableCounter(
|
||||
name,
|
||||
metric.WithDescription(help),
|
||||
metric.WithUnit(unit),
|
||||
)
|
||||
|
||||
case "mbm_total_bytes":
|
||||
name := "l3.mbm.total"
|
||||
help := "total bytes transferred to/from memory through LLC"
|
||||
unit := "bytes"
|
||||
return meter.Int64ObservableCounter(
|
||||
name,
|
||||
metric.WithDescription(help),
|
||||
metric.WithUnit(unit),
|
||||
)
|
||||
}
|
||||
|
||||
// an unknown feature, counter for bytes, gauge otherwise
|
||||
name := ""
|
||||
help := ""
|
||||
unit := ""
|
||||
if strings.HasSuffix(feature, "_bytes") {
|
||||
name = strings.TrimSuffix(feature, "_bytes")
|
||||
unit = "bytes"
|
||||
}
|
||||
name = "l3." + strings.ReplaceAll(name, "_", ".")
|
||||
help = "L3 " + feature
|
||||
|
||||
if unit == "bytes" {
|
||||
return meter.Int64ObservableUpDownCounter(
|
||||
name,
|
||||
metric.WithDescription(help),
|
||||
metric.WithUnit(unit),
|
||||
)
|
||||
}
|
||||
|
||||
return meter.Int64ObservableGauge(
|
||||
name,
|
||||
metric.WithDescription(help),
|
||||
metric.WithUnit(unit),
|
||||
)
|
||||
}
|
||||
|
||||
func observeInstrument(o metric.Observer, m metric.Int64Observable, feature string) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
for _, cls := range GetClasses() {
|
||||
observeGroup(o, m, feature, cls)
|
||||
for _, monGrp := range cls.GetMonGroups() {
|
||||
wg.Add(1)
|
||||
go func(mg MonGroup) {
|
||||
defer wg.Done()
|
||||
observeGroup(o, m, feature, mg, getMonGroupAttributes(mg)...)
|
||||
}(monGrp)
|
||||
}
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func observeGroup(o metric.Observer, m metric.Int64Observable, feature string, g ResctrlGroup, customAttributes ...attribute.KeyValue) {
|
||||
var (
|
||||
allData = g.GetMonData()
|
||||
cgName string
|
||||
mgName string
|
||||
)
|
||||
|
||||
if mg, ok := g.(MonGroup); ok {
|
||||
cgName = mg.Parent().Name()
|
||||
mgName = mg.Name()
|
||||
} else {
|
||||
cgName = g.Name()
|
||||
}
|
||||
|
||||
attributes := attribute.NewSet(
|
||||
attribute.String("rdt.class", cgName),
|
||||
attribute.String("rdt.mon.group", mgName),
|
||||
)
|
||||
|
||||
for cacheID, data := range allData.L3 {
|
||||
if value, ok := data[feature]; ok {
|
||||
o.ObserveInt64(
|
||||
m,
|
||||
int64(value),
|
||||
metric.WithAttributeSet(attributes),
|
||||
metric.WithAttributes(
|
||||
append(
|
||||
[]attribute.KeyValue{
|
||||
attribute.String("cache.id", fmt.Sprint(cacheID)),
|
||||
},
|
||||
customAttributes...,
|
||||
)...,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getMonGroupAttributes(mg MonGroup) []attribute.KeyValue {
|
||||
var (
|
||||
annotations = mg.GetAnnotations()
|
||||
attributes = []attribute.KeyValue{}
|
||||
)
|
||||
|
||||
for _, name := range customLabels {
|
||||
if value, ok := annotations[name]; ok {
|
||||
attributes = append(attributes, attribute.String(name, value))
|
||||
}
|
||||
}
|
||||
|
||||
return attributes
|
||||
}
|
||||
16
vendor/github.com/intel/goresctrl/pkg/rdt/prometheus.go
generated
vendored
16
vendor/github.com/intel/goresctrl/pkg/rdt/prometheus.go
generated
vendored
@@ -102,7 +102,7 @@ func (c *collector) describeL3(feature string) *prometheus.Desc {
|
||||
}
|
||||
|
||||
func (c *collector) collectMonGroupMetrics(ch chan<- prometheus.Metric, mg MonGroup) {
|
||||
annotations := map[string]string{} // mg.GetAnnotations()
|
||||
annotations := mg.GetAnnotations()
|
||||
customLabelValues := make([]string, len(customLabels))
|
||||
for i, name := range customLabels {
|
||||
customLabelValues[i] = annotations[name]
|
||||
@@ -127,10 +127,22 @@ func (c *collector) collectGroupMetrics(ch chan<- prometheus.Metric, g ResctrlGr
|
||||
for feature, value := range data {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.describeL3(feature),
|
||||
prometheus.CounterValue,
|
||||
promValueTypeL3(feature),
|
||||
float64(value),
|
||||
labels...,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// promValueTypeL3 returns Prometheus value type for given L3 metric.
|
||||
func promValueTypeL3(feature string) prometheus.ValueType {
|
||||
switch feature {
|
||||
case "llc_occupancy":
|
||||
return prometheus.GaugeValue
|
||||
case "mbm_local_bytes", "mbm_total_bytes":
|
||||
return prometheus.CounterValue
|
||||
default:
|
||||
return prometheus.GaugeValue
|
||||
}
|
||||
}
|
||||
|
||||
15
vendor/github.com/prometheus/procfs/Makefile.common
generated
vendored
15
vendor/github.com/prometheus/procfs/Makefile.common
generated
vendored
@@ -33,7 +33,7 @@ GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
|
||||
GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
|
||||
|
||||
GO_VERSION ?= $(shell $(GO) version)
|
||||
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))Error Parsing File
|
||||
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
|
||||
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
|
||||
|
||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||
@@ -61,7 +61,8 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
|
||||
SKIP_GOLANGCI_LINT :=
|
||||
GOLANGCI_LINT :=
|
||||
GOLANGCI_LINT_OPTS ?=
|
||||
GOLANGCI_LINT_VERSION ?= v2.0.2
|
||||
GOLANGCI_LINT_VERSION ?= v2.1.5
|
||||
GOLANGCI_FMT_OPTS ?=
|
||||
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
|
||||
# windows isn't included here because of the path separator being different.
|
||||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
|
||||
@@ -156,9 +157,13 @@ $(GOTEST_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
.PHONY: common-format
|
||||
common-format:
|
||||
common-format: $(GOLANGCI_LINT)
|
||||
@echo ">> formatting code"
|
||||
$(GO) fmt $(pkgs)
|
||||
ifdef GOLANGCI_LINT
|
||||
@echo ">> formatting code with golangci-lint"
|
||||
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
|
||||
endif
|
||||
|
||||
.PHONY: common-vet
|
||||
common-vet:
|
||||
@@ -248,8 +253,8 @@ $(PROMU):
|
||||
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
|
||||
rm -r $(PROMU_TMP)
|
||||
|
||||
.PHONY: proto
|
||||
proto:
|
||||
.PHONY: common-proto
|
||||
common-proto:
|
||||
@echo ">> generating code from proto files"
|
||||
@./scripts/genproto.sh
|
||||
|
||||
|
||||
5
vendor/github.com/prometheus/procfs/mdstat.go
generated
vendored
5
vendor/github.com/prometheus/procfs/mdstat.go
generated
vendored
@@ -123,13 +123,16 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) {
|
||||
finish := float64(0)
|
||||
pct := float64(0)
|
||||
recovering := strings.Contains(lines[syncLineIdx], "recovery")
|
||||
reshaping := strings.Contains(lines[syncLineIdx], "reshape")
|
||||
resyncing := strings.Contains(lines[syncLineIdx], "resync")
|
||||
checking := strings.Contains(lines[syncLineIdx], "check")
|
||||
|
||||
// Append recovery and resyncing state info.
|
||||
if recovering || resyncing || checking {
|
||||
if recovering || resyncing || checking || reshaping {
|
||||
if recovering {
|
||||
state = "recovering"
|
||||
} else if reshaping {
|
||||
state = "reshaping"
|
||||
} else if checking {
|
||||
state = "checking"
|
||||
} else {
|
||||
|
||||
33
vendor/github.com/prometheus/procfs/meminfo.go
generated
vendored
33
vendor/github.com/prometheus/procfs/meminfo.go
generated
vendored
@@ -66,6 +66,10 @@ type Meminfo struct {
|
||||
// Memory which has been evicted from RAM, and is temporarily
|
||||
// on the disk
|
||||
SwapFree *uint64
|
||||
// Memory consumed by the zswap backend (compressed size)
|
||||
Zswap *uint64
|
||||
// Amount of anonymous memory stored in zswap (original size)
|
||||
Zswapped *uint64
|
||||
// Memory which is waiting to get written back to the disk
|
||||
Dirty *uint64
|
||||
// Memory which is actively being written back to the disk
|
||||
@@ -85,6 +89,8 @@ type Meminfo struct {
|
||||
// amount of memory dedicated to the lowest level of page
|
||||
// tables.
|
||||
PageTables *uint64
|
||||
// secondary page tables.
|
||||
SecPageTables *uint64
|
||||
// NFS pages sent to the server, but not yet committed to
|
||||
// stable storage
|
||||
NFSUnstable *uint64
|
||||
@@ -129,15 +135,18 @@ type Meminfo struct {
|
||||
Percpu *uint64
|
||||
HardwareCorrupted *uint64
|
||||
AnonHugePages *uint64
|
||||
FileHugePages *uint64
|
||||
ShmemHugePages *uint64
|
||||
ShmemPmdMapped *uint64
|
||||
CmaTotal *uint64
|
||||
CmaFree *uint64
|
||||
Unaccepted *uint64
|
||||
HugePagesTotal *uint64
|
||||
HugePagesFree *uint64
|
||||
HugePagesRsvd *uint64
|
||||
HugePagesSurp *uint64
|
||||
Hugepagesize *uint64
|
||||
Hugetlb *uint64
|
||||
DirectMap4k *uint64
|
||||
DirectMap2M *uint64
|
||||
DirectMap1G *uint64
|
||||
@@ -161,6 +170,8 @@ type Meminfo struct {
|
||||
MlockedBytes *uint64
|
||||
SwapTotalBytes *uint64
|
||||
SwapFreeBytes *uint64
|
||||
ZswapBytes *uint64
|
||||
ZswappedBytes *uint64
|
||||
DirtyBytes *uint64
|
||||
WritebackBytes *uint64
|
||||
AnonPagesBytes *uint64
|
||||
@@ -171,6 +182,7 @@ type Meminfo struct {
|
||||
SUnreclaimBytes *uint64
|
||||
KernelStackBytes *uint64
|
||||
PageTablesBytes *uint64
|
||||
SecPageTablesBytes *uint64
|
||||
NFSUnstableBytes *uint64
|
||||
BounceBytes *uint64
|
||||
WritebackTmpBytes *uint64
|
||||
@@ -182,11 +194,14 @@ type Meminfo struct {
|
||||
PercpuBytes *uint64
|
||||
HardwareCorruptedBytes *uint64
|
||||
AnonHugePagesBytes *uint64
|
||||
FileHugePagesBytes *uint64
|
||||
ShmemHugePagesBytes *uint64
|
||||
ShmemPmdMappedBytes *uint64
|
||||
CmaTotalBytes *uint64
|
||||
CmaFreeBytes *uint64
|
||||
UnacceptedBytes *uint64
|
||||
HugepagesizeBytes *uint64
|
||||
HugetlbBytes *uint64
|
||||
DirectMap4kBytes *uint64
|
||||
DirectMap2MBytes *uint64
|
||||
DirectMap1GBytes *uint64
|
||||
@@ -287,6 +302,12 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
|
||||
case "SwapFree:":
|
||||
m.SwapFree = &val
|
||||
m.SwapFreeBytes = &valBytes
|
||||
case "Zswap:":
|
||||
m.Zswap = &val
|
||||
m.ZswapBytes = &valBytes
|
||||
case "Zswapped:":
|
||||
m.Zswapped = &val
|
||||
m.ZswapBytes = &valBytes
|
||||
case "Dirty:":
|
||||
m.Dirty = &val
|
||||
m.DirtyBytes = &valBytes
|
||||
@@ -317,6 +338,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
|
||||
case "PageTables:":
|
||||
m.PageTables = &val
|
||||
m.PageTablesBytes = &valBytes
|
||||
case "SecPageTables:":
|
||||
m.SecPageTables = &val
|
||||
m.SecPageTablesBytes = &valBytes
|
||||
case "NFS_Unstable:":
|
||||
m.NFSUnstable = &val
|
||||
m.NFSUnstableBytes = &valBytes
|
||||
@@ -350,6 +374,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
|
||||
case "AnonHugePages:":
|
||||
m.AnonHugePages = &val
|
||||
m.AnonHugePagesBytes = &valBytes
|
||||
case "FileHugePages:":
|
||||
m.FileHugePages = &val
|
||||
m.FileHugePagesBytes = &valBytes
|
||||
case "ShmemHugePages:":
|
||||
m.ShmemHugePages = &val
|
||||
m.ShmemHugePagesBytes = &valBytes
|
||||
@@ -362,6 +389,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
|
||||
case "CmaFree:":
|
||||
m.CmaFree = &val
|
||||
m.CmaFreeBytes = &valBytes
|
||||
case "Unaccepted:":
|
||||
m.Unaccepted = &val
|
||||
m.UnacceptedBytes = &valBytes
|
||||
case "HugePages_Total:":
|
||||
m.HugePagesTotal = &val
|
||||
case "HugePages_Free:":
|
||||
@@ -373,6 +403,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) {
|
||||
case "Hugepagesize:":
|
||||
m.Hugepagesize = &val
|
||||
m.HugepagesizeBytes = &valBytes
|
||||
case "Hugetlb:":
|
||||
m.Hugetlb = &val
|
||||
m.HugetlbBytes = &valBytes
|
||||
case "DirectMap4k:":
|
||||
m.DirectMap4k = &val
|
||||
m.DirectMap4kBytes = &valBytes
|
||||
|
||||
12
vendor/github.com/prometheus/procfs/proc_stat.go
generated
vendored
12
vendor/github.com/prometheus/procfs/proc_stat.go
generated
vendored
@@ -101,6 +101,12 @@ type ProcStat struct {
|
||||
RSS int
|
||||
// Soft limit in bytes on the rss of the process.
|
||||
RSSLimit uint64
|
||||
// The address above which program text can run.
|
||||
StartCode uint64
|
||||
// The address below which program text can run.
|
||||
EndCode uint64
|
||||
// The address of the start (i.e., bottom) of the stack.
|
||||
StartStack uint64
|
||||
// CPU number last executed on.
|
||||
Processor uint
|
||||
// Real-time scheduling priority, a number in the range 1 to 99 for processes
|
||||
@@ -177,9 +183,9 @@ func (p Proc) Stat() (ProcStat, error) {
|
||||
&s.VSize,
|
||||
&s.RSS,
|
||||
&s.RSSLimit,
|
||||
&ignoreUint64,
|
||||
&ignoreUint64,
|
||||
&ignoreUint64,
|
||||
&s.StartCode,
|
||||
&s.EndCode,
|
||||
&s.StartStack,
|
||||
&ignoreUint64,
|
||||
&ignoreUint64,
|
||||
&ignoreUint64,
|
||||
|
||||
116
vendor/github.com/prometheus/procfs/proc_statm.go
generated
vendored
Normal file
116
vendor/github.com/prometheus/procfs/proc_statm.go
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
// Copyright 2025 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// - https://man7.org/linux/man-pages/man5/proc_pid_statm.5.html
|
||||
|
||||
// ProcStatm Provides memory usage information for a process, measured in memory pages.
|
||||
// Read from /proc/[pid]/statm.
|
||||
type ProcStatm struct {
|
||||
// The process ID.
|
||||
PID int
|
||||
// total program size (same as VmSize in status)
|
||||
Size uint64
|
||||
// resident set size (same as VmRSS in status)
|
||||
Resident uint64
|
||||
// number of resident shared pages (i.e., backed by a file)
|
||||
Shared uint64
|
||||
// text (code)
|
||||
Text uint64
|
||||
// library (unused since Linux 2.6; always 0)
|
||||
Lib uint64
|
||||
// data + stack
|
||||
Data uint64
|
||||
// dirty pages (unused since Linux 2.6; always 0)
|
||||
Dt uint64
|
||||
}
|
||||
|
||||
// NewStatm returns the current status information of the process.
|
||||
// Deprecated: Use p.Statm() instead.
|
||||
func (p Proc) NewStatm() (ProcStatm, error) {
|
||||
return p.Statm()
|
||||
}
|
||||
|
||||
// Statm returns the current memory usage information of the process.
|
||||
func (p Proc) Statm() (ProcStatm, error) {
|
||||
data, err := util.ReadFileNoStat(p.path("statm"))
|
||||
if err != nil {
|
||||
return ProcStatm{}, err
|
||||
}
|
||||
|
||||
statmSlice, err := parseStatm(data)
|
||||
if err != nil {
|
||||
return ProcStatm{}, err
|
||||
}
|
||||
|
||||
procStatm := ProcStatm{
|
||||
PID: p.PID,
|
||||
Size: statmSlice[0],
|
||||
Resident: statmSlice[1],
|
||||
Shared: statmSlice[2],
|
||||
Text: statmSlice[3],
|
||||
Lib: statmSlice[4],
|
||||
Data: statmSlice[5],
|
||||
Dt: statmSlice[6],
|
||||
}
|
||||
|
||||
return procStatm, nil
|
||||
}
|
||||
|
||||
// parseStatm return /proc/[pid]/statm data to uint64 slice.
|
||||
func parseStatm(data []byte) ([]uint64, error) {
|
||||
var statmSlice []uint64
|
||||
statmItems := strings.Fields(string(data))
|
||||
for i := 0; i < len(statmItems); i++ {
|
||||
statmItem, err := strconv.ParseUint(statmItems[i], 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
statmSlice = append(statmSlice, statmItem)
|
||||
}
|
||||
return statmSlice, nil
|
||||
}
|
||||
|
||||
// SizeBytes returns the process of total program size in bytes.
|
||||
func (s ProcStatm) SizeBytes() uint64 {
|
||||
return s.Size * uint64(os.Getpagesize())
|
||||
}
|
||||
|
||||
// ResidentBytes returns the process of resident set size in bytes.
|
||||
func (s ProcStatm) ResidentBytes() uint64 {
|
||||
return s.Resident * uint64(os.Getpagesize())
|
||||
}
|
||||
|
||||
// SHRBytes returns the process of share memory size in bytes.
|
||||
func (s ProcStatm) SHRBytes() uint64 {
|
||||
return s.Shared * uint64(os.Getpagesize())
|
||||
}
|
||||
|
||||
// TextBytes returns the process of text (code) size in bytes.
|
||||
func (s ProcStatm) TextBytes() uint64 {
|
||||
return s.Text * uint64(os.Getpagesize())
|
||||
}
|
||||
|
||||
// DataBytes returns the process of data + stack size in bytes.
|
||||
func (s ProcStatm) DataBytes() uint64 {
|
||||
return s.Data * uint64(os.Getpagesize())
|
||||
}
|
||||
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
@@ -350,8 +350,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2/runtime
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2/utilities
|
||||
# github.com/hashicorp/errwrap v1.1.0
|
||||
## explicit
|
||||
# github.com/intel/goresctrl v0.10.0
|
||||
## explicit; go 1.23
|
||||
# github.com/intel/goresctrl v0.11.0
|
||||
## explicit; go 1.23.0
|
||||
github.com/intel/goresctrl/pkg/blockio
|
||||
github.com/intel/goresctrl/pkg/kubernetes
|
||||
github.com/intel/goresctrl/pkg/path
|
||||
@@ -479,7 +479,7 @@ github.com/prometheus/client_model/go
|
||||
## explicit; go 1.23.0
|
||||
github.com/prometheus/common/expfmt
|
||||
github.com/prometheus/common/model
|
||||
# github.com/prometheus/procfs v0.16.1
|
||||
# github.com/prometheus/procfs v0.17.0
|
||||
## explicit; go 1.23.0
|
||||
github.com/prometheus/procfs
|
||||
github.com/prometheus/procfs/internal/fs
|
||||
|
||||
Reference in New Issue
Block a user