Skip to content

Commit c66e798

Browse files
committed
add processor field for /proc/[pid]/stat
Signed-off-by: peter wang <wangbo.red@gmail.com>
1 parent f74c35e commit c66e798

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

proc_stat.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ type ProcStat struct {
102102
RSS int
103103
// Soft limit in bytes on the rss of the process.
104104
RSSLimit uint64
105+
// CPU number last executed on.
106+
Processor uint
105107
// Real-time scheduling priority, a number in the range 1 to 99 for processes
106108
// scheduled under a real-time policy, or 0, for non-real-time processes.
107109
RTPriority uint
@@ -184,7 +186,7 @@ func (p Proc) Stat() (ProcStat, error) {
184186
&ignoreUint64,
185187
&ignoreUint64,
186188
&ignoreInt64,
187-
&ignoreInt64,
189+
&s.Processor,
188190
&s.RTPriority,
189191
&s.Policy,
190192
&s.DelayAcctBlkIOTicks,

proc_stat_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func TestProcStat(t *testing.T) {
6868
want uint
6969
have uint
7070
}{
71+
{name: "processor", want: 0, have: s.Processor},
7172
{name: "rt_priority", want: 0, have: s.RTPriority},
7273
{name: "policy", want: 0, have: s.Policy},
7374
} {

0 commit comments

Comments
 (0)