MCPcopy Create free account
hub / github.com/prometheus/procfs / Netstat

Method Netstat

proc_netstat.go:172–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172func (p Proc) Netstat() (ProcNetstat, error) {
173 filename := p.path("net/netstat")
174 data, err := util.ReadFileNoStat(filename)
175 if err != nil {
176 return ProcNetstat{PID: p.PID}, err
177 }
178 procNetstat, err := parseProcNetstat(bytes.NewReader(data), filename)
179 procNetstat.PID = p.PID
180 return procNetstat, err
181}
182
183// parseProcNetstat parses the metrics from proc/<pid>/net/netstat file
184// and returns a ProcNetstat structure.

Callers 1

TestProcNetstatFunction · 0.80

Calls 3

pathMethod · 0.95
ReadFileNoStatFunction · 0.92
parseProcNetstatFunction · 0.85

Tested by 1

TestProcNetstatFunction · 0.64