-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatm2.awk
32 lines (30 loc) · 970 Bytes
/
statm2.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#USAGE: for f in /proc/*/statm; do cat $f; done | awk -f statm2.awk
# Copyright (C) 2011 Rafael Aquini <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
BEGIN {
PGSZ=4;
printf("%10s %10s %10s %10s %10s %10s\n", "VMSIZE", "RSS",
"SHARED", "ANON", "TEXT", "DATA")
}
{
VMSIZE += $1;
RSS += $2;
SHARED += $3;
TEXT += $4;
DATA += $6;
}
END {
ANON = RSS-SHARED
printf("%10s %10s %10s %10s %10s %10s\n", VMSIZE*PGSZ, RSS*PGSZ,
SHARED*PGSZ, ANON*PGSZ, TEXT*PGSZ, DATA*PGSZ)
}