1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 23:36:58 +00:00

vendor change

This commit is contained in:
kinarashah
2019-09-25 14:32:29 -07:00
committed by Alena Prokharchyk
parent a40a48add2
commit 5bbe7031a6
607 changed files with 114217 additions and 60063 deletions

View File

@@ -18,8 +18,6 @@ import (
"fmt"
"io/ioutil"
"os"
"github.com/prometheus/procfs/internal/fs"
)
// Originally, this USER_HZ value was dynamically retrieved via a sysconf call
@@ -97,22 +95,15 @@ type ProcStat struct {
// in clock ticks.
Starttime uint64
// Virtual memory size in bytes.
VSize uint
VSize int
// Resident set size in pages.
RSS int
proc fs.FS
fs FS
}
// NewStat returns the current status information of the process.
//
// Deprecated: use p.Stat() instead
func (p Proc) NewStat() (ProcStat, error) {
return p.Stat()
}
// Stat returns the current status information of the process.
func (p Proc) Stat() (ProcStat, error) {
f, err := os.Open(p.path("stat"))
if err != nil {
return ProcStat{}, err
@@ -127,7 +118,7 @@ func (p Proc) Stat() (ProcStat, error) {
var (
ignore int
s = ProcStat{PID: p.PID, proc: p.fs}
s = ProcStat{PID: p.PID, fs: p.fs}
l = bytes.Index(data, []byte("("))
r = bytes.LastIndex(data, []byte(")"))
)
@@ -173,7 +164,7 @@ func (p Proc) Stat() (ProcStat, error) {
}
// VirtualMemory returns the virtual memory size in bytes.
func (s ProcStat) VirtualMemory() uint {
func (s ProcStat) VirtualMemory() int {
return s.VSize
}
@@ -184,8 +175,7 @@ func (s ProcStat) ResidentMemory() int {
// StartTime returns the unix timestamp of the process in seconds.
func (s ProcStat) StartTime() (float64, error) {
fs := FS{proc: s.proc}
stat, err := fs.Stat()
stat, err := s.fs.NewStat()
if err != nil {
return 0, err
}