mmalecki/meminfo — pull request #1 by tjfontaine (2012-05-04 20:32:22+00:00)
Title: Add method to report the smaps for a given pid

inspects either `/proc/self/smaps` or `/proc//smaps` and returns the parsed results

```js
meminfo.smaps(function (err, results) {
console.log(results.totals);
});
```

Output is:

```js
{
"size": "576.98 mB",
"rss": "7.23 mB",
"pss": "6.46 mB",
"shared_clean": "980 kB",
"shared_dirty": "0 kB",
"private_clean": "3.25 mB",
"private_dirty": "3.02 mB",
"referenced": "7.23 mB",
"anonymous": "3.02 mB",
"swap": "0 kB",
"kernelpagesize": "252 kB",
"mmupagesize": "252 kB",
"locked": "0 kB"
}
```

There are top level objects for totals, heap, stack, vdso, vsyscall. The rest fall under the name of the file mapped or `` here is the sample structure

```js
{
"totals": {
"size": "576.98 mB",
"rss": "7.23 mB",
"pss": "6.46 mB",
"shared_clean": "980 kB",
"shared_dirty": "0 kB",
"private_clean": "3.25 mB",
"private_dirty": "3.02 mB",
"referenced": "7.23 mB",
"anonymous": "3.02 mB",
"swap": "0 kB",
"kernelpagesize": "252 kB",
"mmupagesize": "252 kB",
"locked": "0 kB"
},
"heap": {
"region": "01827000-018a5000",
"permissions": "rw-p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "[heap]",
"size": "504kB",
"rss": "500kB",
"pss": "500kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "500kB",
"referenced": "500kB",
"anonymous": "500kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
"stack": {
"region": "7fffb4204000-7fffb4225000",
"permissions": "rw-p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "[stack]",
"size": "136kB",
"rss": "32kB",
"pss": "32kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "32kB",
"referenced": "32kB",
"anonymous": "32kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
"vdso": {
"region": "7fffb436a000-7fffb436b000",
"permissions": "r-xp",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "[vdso]",
"size": "4kB",
"rss": "4kB",
"pss": "0kB",
"shared_clean": "4kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "4kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
"vsyscall": {
"region": "ffffffffff600000-ffffffffff601000",
"permissions": "r-xp",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "[vsyscall]",
"size": "4kB",
"rss": "0kB",
"pss": "0kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "0kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
"vsyscall": {
"region": "ffffffffff600000-ffffffffff601000",
"permissions": "r-xp",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "[vsyscall]",
"size": "4kB",
"rss": "0kB",
"pss": "0kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "0kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
"/home/tjfontaine/.give/installed/master/bin/node": [
{
"region": "00400000-00bff000",
"permissions": "r-xp",
"offset": "00000000",
"device": "08:01",
"inode": "556304",
"path": "/home/tjfontaine/.give/installed/master/bin/node",
"size": "8188kB",
"rss": "3292kB",
"pss": "3292kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "3292kB",
"private_dirty": "0kB",
"referenced": "3292kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "00dfe000-00dff000",
"permissions": "r--p",
"offset": "007fe000",
"device": "08:01",
"inode": "556304",
"path": "/home/tjfontaine/.give/installed/master/bin/node",
"size": "4kB",
"rss": "4kB",
"pss": "4kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "4kB",
"referenced": "4kB",
"anonymous": "4kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "00dff000-00e10000",
"permissions": "rw-p",
"offset": "007ff000",
"device": "08:01",
"inode": "556304",
"path": "/home/tjfontaine/.give/installed/master/bin/node",
"size": "68kB",
"rss": "16kB",
"pss": "16kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "8kB",
"private_dirty": "8kB",
"referenced": "16kB",
"anonymous": "8kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
}
],
"": [
{
"region": "00e10000-00e1a000",
"permissions": "rw-p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "40kB",
"rss": "28kB",
"pss": "28kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "28kB",
"referenced": "28kB",
"anonymous": "28kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "badfc2b000-badfc40000",
"permissions": "---p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "84kB",
"rss": "0kB",
"pss": "0kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "0kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "badfc40000-badfc60000",
"permissions": "rw-p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "128kB",
"rss": "24kB",
"pss": "24kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "24kB",
"referenced": "24kB",
"anonymous": "24kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "badfc60000-badfc8b000",
"permissions": "---p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "172kB",
"rss": "0kB",
"pss": "0kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "0kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "8dc33500000-8dc33600000",
"permissions": "rw-p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "1024kB",
"rss": "84kB",
"pss": "84kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "84kB",
"referenced": "84kB",
"anonymous": "84kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
},
{
"region": "12d6dc000000-12d6dcf00000",
"permissions": "---p",
"offset": "00000000",
"device": "00:00",
"inode": "0",
"path": "",
"size": "15360kB",
"rss": "0kB",
"pss": "0kB",
"shared_clean": "0kB",
"shared_dirty": "0kB",
"private_clean": "0kB",
"private_dirty": "0kB",
"referenced": "0kB",
"anonymous": "0kB",
"swap": "0kB",
"kernelpagesize": "4kB",
"mmupagesize": "4kB",
"locked": "0kB"
}
]
}
```