Skip to content

Commit

Permalink
Add NSpid to proc status
Browse files Browse the repository at this point in the history
Signed-off-by: Nir Levy <[email protected]>
  • Loading branch information
Nir committed Aug 7, 2023
1 parent 113c501 commit 7f9cf4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proc_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type ProcStatus struct {

// Thread group ID.
TGID int
// Pid namespace.
NSpid int

// Peak virtual memory size.
VmPeak uint64 // nolint:revive
Expand Down Expand Up @@ -127,6 +129,8 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt
copy(s.UIDs[:], strings.Split(vString, "\t"))
case "Gid":
copy(s.GIDs[:], strings.Split(vString, "\t"))
case "NSpid":
s.NSpid = int(vUint)
case "VmPeak":
s.VmPeak = vUintBytes
case "VmSize":
Expand Down
1 change: 1 addition & 0 deletions proc_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestProcStatus(t *testing.T) {
}{
{name: "Pid", want: 26231, have: s.PID},
{name: "Tgid", want: 26231, have: s.TGID},
{name: "NSpid", want: 1, have: s.NSpid},
{name: "VmPeak", want: 58472 * 1024, have: int(s.VmPeak)},
{name: "VmSize", want: 58440 * 1024, have: int(s.VmSize)},
{name: "VmLck", want: 0 * 1024, have: int(s.VmLck)},
Expand Down

0 comments on commit 7f9cf4b

Please sign in to comment.