Skip to content

Commit

Permalink
feat: parse StartCode, EndCode, and StartStack in /proc/pid/stat
Browse files Browse the repository at this point in the history
  • Loading branch information
pgimalac committed Aug 22, 2024
1 parent 09209a4 commit 15960ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions proc_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions proc_stat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func TestProcStat(t *testing.T) {
have uint64
}{
{name: "RSS Limit", want: 18446744073709551615, have: s.RSSLimit},
{name: "Start Code", want: 4194304, have: s.StartCode},
{name: "End Code", want: 6294284, have: s.EndCode},
{name: "Start Stack", want: 140736914091744, have: s.StartStack},
{name: "delayacct_blkio_ticks", want: 31, have: s.DelayAcctBlkIOTicks},
} {
if test.want != test.have {
Expand Down

0 comments on commit 15960ea

Please sign in to comment.