0

From my understanding, the value returned from

(1) awk '/Rss:/{ sum += $2 } END { print sum }' /proc/$$/smaps

and

(2) cat /proc/$$/stat | cut -d " " -f24

should be equal, why is this not the case?

They are in fact a factor of 4 out, so (1)/4 = (2) from everything I have tested

Details of the files can be found at man 5 proc

uname -a: Linux home-server 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

dippynark
  • 2,743
  • 20
  • 58

1 Answers1

0

The rss field in the stat file is in pages. A page on most hardware will be of size 4096 bytes. Since you are comparing this with a field in kilobytes, you can easily see how you got a factor-of-4 difference: 4096 / 1024 = 4.