Source File
proc_status.go
Belonging Package
github.com/prometheus/procfs
package procfs
import (
)
func ( Proc) () (ProcStatus, error) {
, := util.ReadFileNoStat(.path("status"))
if != nil {
return ProcStatus{},
}
:= ProcStatus{PID: .PID}
:= strings.Split(string(), "\n")
for , := range {
if !bytes.Contains([]byte(), []byte(":")) {
continue
}
:= strings.SplitN(, ":", 2)
:= * 1024
.fillStatus(, , , )
}
return , nil
}
func ( *ProcStatus) ( string, string, uint64, uint64) {
switch {
case "Tgid":
.TGID = int()
case "Name":
.Name =
case "VmPeak":
.VmPeak =
case "VmSize":
.VmSize =
case "VmLck":
.VmLck =
case "VmPin":
.VmPin =
case "VmHWM":
.VmHWM =
case "VmRSS":
.VmRSS =
case "RssAnon":
.RssAnon =
case "RssFile":
.RssFile =
case "RssShmem":
.RssShmem =
case "VmData":
.VmData =
case "VmStk":
.VmStk =
case "VmExe":
.VmExe =
case "VmLib":
.VmLib =
case "VmPTE":
.VmPTE =
case "VmPMD":
.VmPMD =
case "VmSwap":
.VmSwap =
case "HugetlbPages":
.HugetlbPages =
case "voluntary_ctxt_switches":
.VoluntaryCtxtSwitches =
case "nonvoluntary_ctxt_switches":
.NonVoluntaryCtxtSwitches =
}
}
func ( ProcStatus) () uint64 {
return .VoluntaryCtxtSwitches + .NonVoluntaryCtxtSwitches
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |