1SMEM(8) SMEM(8)
2
3
4
6 smem - Report memory usage with shared memory divided proportionally.
7
8
10 smem [options]
11
12
14 smem reports physical memory usage, taking shared memory pages into
15 account. Unshared memory is reported as the USS (Unique Set Size).
16 Shared memory is divided evenly among the processes sharing that mem‐
17 ory. The unshared memory (USS) plus a process's proportion of shared
18 memory is reported as the PSS (Proportional Set Size). The USS and PSS
19 only include physical memory usage. They do not include memory that
20 has been swapped out to disk.
21
22 Memory can be reported by process, by user, by mapping, or systemwide.
23 Both text mode and graphical output are available.
24
25
27 GENERAL OPTIONS
28 -h, --help
29 Show help.
30
31
32 SOURCE DATA
33 By default, smem will pull most of the data it needs from the /proc
34 filesystem of the system it is running on. The --source option lets
35 you used a tarred set of /proc data saved earlier, possibly on a dif‐
36 ferent machine. The --kernel and --realmem options let you specify a
37 couple things that smem cannot discover on its own.
38
39
40
41 -K KERNEL, --kernel=KERNEL
42 Path to an uncompressed kernel image. This lets smem include
43 the size of the kernel's code and statically allocated data in
44 the systemwide (-w) output. (To obtain an uncompressed image of
45 a kernel on disk, you may need to build the kernel yourself,
46 then locate file vmlinux in the source tree.)
47
48
49 -R REALMEM, --realmem=REALMEM
50 Amount of physical RAM. This lets smem detect the amount of
51 memory used by firmware/hardware in the systemwide (-w) output.
52 If provided, it will also be used as the total memory size to
53 base percentages on. Example: --realmem=1024M
54
55
56 -S SOURCE, --source=SOURCE
57 /proc data source. This lets you specify an alternate source of
58 the /proc data. For example, you can capture data from an
59 embedded system using smemcap, and parse the data later on a
60 different machine. If the --source option is not included, smem
61 reports memory usage on the running system.
62
63
64 REPORT BY
65 If none of the following options are included, smem reports memory
66 usage by process.
67
68
69 -m, --mappings
70 Report memory usage by mapping.
71
72
73 -u, --users
74 Report memory usage by user.
75
76
77 -w, --system
78 Report systemwide memory usage summary.
79
80
81 FILTER BY
82 If none of these options are included, memory usage is reported for all
83 processes, users, or mappings. (Note: If you are running as a non-root
84 user, and if you are not using the --source options, then you will only
85 see data from processes whose /proc/ information you have access to.)
86
87
88 -M MAPFILTER, --mapfilter=MAPFILTER
89 Mapping filter regular expression.
90
91
92 -P PROCESSFILTER, --processfilter=PROCESSFILTER
93 Process filter regular expression.
94
95
96 -U USERFILTER, --userfilter=USERFILTER
97 User filter regular expression.
98
99
100 OUTPUT FORMATTING
101 -a, --autosize
102 Size columns to fit terminal size.
103
104
105 -c COLUMNS, --columns=COLUMNS
106 Columns to show.
107
108
109 -H, --no-header
110 Disable header line.
111
112
113 -k, --abbreviate
114 Show unit suffixes.
115
116
117 -n, --numeric
118 Show numeric user IDs instead of usernames.
119
120
121 -p, --percent
122 Show percentages.
123
124
125 -r, --reverse
126 Reverse sort.
127
128
129 -s SORT, --sort=SORT
130 Field to sort on.
131
132
133 -t, --totals
134 Show totals.
135
136
137 OUTPUT TYPE
138 These options specify graphical output styles.
139
140
141 --bar=BAR
142 Show bar graph.
143
144
145 --pie=PIE
146 Show pie graph.
147
148
150 smem requires:
151
152
153 · Linux kernel providing 'Pss' metric in /proc/<pid>/smaps (generally
154 2.6.27 or newer).
155
156 · Python 2.x (at least 2.4 or so).
157
158 · The matplotlib library (only if you want to generate graphical
159 charts).
160
161
163 To capture memory statistics on resource-constrained systems, the the
164 smem source includes a utility named smemcap. smemcap captures all
165 /proc entries required by smem and outputs them as an uncompressed .tar
166 file to STDOUT. smem can analyze the output using the --source option.
167 smemcap is small and does not require Python.
168
169 To use smemcap:
170
171 1. Obtain the smem source at http://selenic.com/repo/smem
172
173 2. Compile smemcap.c for your target system.
174
175 3. Run smemcap on the target system and save the output:
176 smemcap > memorycapture.tar
177
178 4. Copy the output to another machine and run smem on it:
179 smem -S memorycapture.tar
180
181
183 /proc/$pid/cmdline
184
185 /proc/$pid/smaps
186
187 /proc/$pid/stat
188
189 /proc/meminfo
190
191 /proc/version
192
193
195 Main Web Site: http://www.selenic.com/smem
196
197 Source code repository: http://selenic.com/repo/smem
198
199 Mailing list: http://selenic.com/mailman/listinfo/smem
200
201
203 free(1), pmap(1), proc(5), ps(1), top(1), vmstat(8)
204
205
207 Copyright (C) 2008-2009 Matt Mackall. Free use of this software is
208 granted under the terms of the GNU General Public License version 2 or
209 later.
210
211
213 smem was written by Matt Mackall.
214
215
216
217
218 03/15/2010 SMEM(8)