Commit graph

58 commits

Author SHA1 Message Date
Paul Townsend
323e6491c4 Grab uid info from /proc/<pid>/ stat 2011-08-22 16:09:17 -05:00
Paul Townsend
bc48175929 Catch KeyError on uid and gid conversion 2011-08-17 17:16:21 -04:00
Matt Mackall
0245f382ba Use /usr/bin/env to locate Python 2011-08-17 16:31:34 -05:00
Matt Mackall
0279ad465a Actively detect PSS support
Rather than checking the kernel version, look for PSS field when
parsing smaps data and issue a warning.

(based on a suggestion by Paul Townsend)
2011-08-17 13:49:33 -05:00
Matt Mackall
4cb161ea45 read process uid/gid from task rather than cmdline 2011-06-10 08:58:26 -05:00
Matt Mackall
27fe66a83c Add support for terabytes 2011-05-26 09:17:28 -05:00
Matt Mackall
5c14f57b31 Added tag 1.0 for changeset 4f6b9d5b28e8 2011-02-16 16:26:56 -06:00
Tim Bird
7b68171f07 Fix bug in pie chart logic 1.0
I was getting an error with pie charts on some systems
with very small memory usage.

$ smem -S data.tar --pie=command
Traceback (most recent call last):
  File "/usr/local/bin/smem", line 636, in <module>
    showpids()
  File "/usr/local/bin/smem", line 246, in showpids
    showtable(pt.keys(), fields, columns.split(), options.sort or 'pss')
  File "/usr/local/bin/smem", line 455, in showtable
    showpie(l, sort)
  File "/usr/local/bin/smem", line 498, in showpie
    while values and (t + values[-1 - c] < (tm * .02) or
IndexError: list index out of range

I traced it to a bug in showpie, where there's some confused
usage of a list index and list popping.

In showpie, c is used to index into the values in a while
loop that removes entries from the end of a sorted list,
and aggregates their values for use in an "other" entry,
added to the list before display.

Moving (and using) the index is wrong because the list is being
chopped from the end as we go.  This warps the value of 'other',
but under normal circumstances would probably not be noticeable
because these items have very small values.
However, if several items are popped, and the list is very short,
it can result in the list index error above.

Also, truncating the values and labels in the subsequent
conditional is redundant with the pop in the loop.

Below is a patch to fix these problems.
 -- Tim

---
 smem |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
2011-02-16 16:12:50 -06:00
Hynek Cernoch
e2c5ced39a Clean up some tabs 2010-12-13 22:33:05 +01:00
Hynek Cernoch
fc150ea960 Give hint about uncompressed kernels 2010-12-13 22:33:05 +01:00
Hynek Cernoch
b0a3fae0e7 Add note about --realmem usage to manpage 2010-12-13 22:33:05 +01:00
Hynek Cernoch
455466fb67 Fixed bug in realmem option 2010-12-13 22:33:05 +01:00
Yves Goergen
c082952423 Avoid tracebacks on disappearing processes 2011-02-16 16:01:38 -06:00
Johannes Stezenbach
3d21e5daf3 smemcap: fix compile warnings 2010-05-12 15:59:24 -05:00
Dean Peterson
4bd765bc0c man page patch, including embedded section mentioning smemcap
Here is a patch for the smem man page.  It includes the following:

 * A new section on embedded usage briefly describing smemcap
   NOTE: Someone please doublecheck it,
         since I am not an embedded developer.
 * Mentions that kernel image for -K option must be uncompressed.
 * A new copyright section.
 * A new resources section.
 * Replaces notes with a requirements section.
 * Adds a couple of commands to the see also list.
 * Fixes a couple typos.
2010-03-29 16:38:31 -05:00
Michal ?iha?
9ad7a9f60c Escape dashes in man page
there are two dashes in man page which were forgotten to be escaped.
Attached patch fixes it.
2010-01-02 15:53:04 +01:00
Matt Mackall
5777a0c9c3 Drop obsolete capture script 2010-03-29 16:19:21 -05:00
Matt Mackall
54ffd3fca7 Added tag 0.9 for changeset 708dd2e1b91a 2009-11-11 11:03:21 -06:00
lethargo
6877fc1daa add smem man page 0.9
A while back Matthew Miller asked about a man page for smem.  Here is a proposed start of one.
2009-07-15 17:16:34 -05:00
Matt Mackall
d3d782beb0 Fix _ucache some more 2009-07-06 15:20:41 -05:00
Matt Mackall
dbe27ffe29 Fix references to _ucache and _gcache 2009-07-06 15:20:05 -05:00
Matt Mackall
7650aa076d tar source: use usernames and groupnames from tarfile if available 2009-06-23 17:01:12 -05:00
Matt Mackall
a0447bc26b Fix some tar header issues for smemcap 2009-06-08 15:15:37 -05:00
Matt Mackall
c8bb8425b2 Make system memory reporting more robust
- totalmem should return kB when provided manually
- firmware size never goes below zero
- add comments
- calculate kernel portion of cached by subtracting mapped rather than
  anonymous
- get rid of sum() bits for silly column totals
2009-05-27 18:12:00 -05:00
Matt Mackall
383d6480df add smemcap tool 2009-05-22 17:31:54 -05:00
Matt Mackall
dac4809c06 be less picky about tar directories 2009-05-22 17:29:51 -05:00
Tim Bird
67aee6e39d Kernel version >= 2.6.27 check
Jeff Schroeder wrote:
> Awesome tool! I learned about this from the LWN article and
> immediately (stupidly) tried it out on a centos 5 host. Here is a
> patch to add a kernel version check.

This is a nice fix, but the version check should be done against
the proc data being used (which is not necessarily that of the
local kernel).  This required moving kernel_version_check to
after where the src data is read.
2009-05-22 12:41:07 -05:00
Ademar de Souza Reis Jr
b2041ff9b6 Fix broken -n option
[ademar@optimus smem]$ ./smem -n
Traceback (most recent call last):
  File "./smem", line 624, in <module>
  ...
2009-05-21 11:46:37 -03:00
???
04b9f552f4 [PATCH] invalid "-K" value cause smem ended with IndexError exception
I do "smem -w -K a.txt -R 2048M" and got following error:
zhichyu@w-shpd-zcyu:~/sftw4ubuntu$ smem-0.1/smem -w -K a.txt -R 2048M
size: 'a.txt': No such file
Traceback (most recent call last):
  File "smem-0.1/smem", line 607, in <module>
    showsystem()
  File "smem-0.1/smem", line 361, in showsystem
    k = kernelsize()
  File "smem-0.1/smem", line 77, in kernelsize
    d = os.popen("size %s" % options.kernel).readlines()[1]
IndexError: list index out of range

The root cause is that os.popen("size a.txt") returns only one line.
If the user provides an invalid kernel image file path, I think it's
better to assume the image size is zero than raise an exception.
2009-05-14 22:22:44 -05:00
???
4865bf2967 [PATCH] physical memory size computing error
There are two minor bugs on physical memory size computing:
(1) fromunits() returns wrong value for "2001844kB", which consists of
more than one digits.
(2) memory()['memtotal'] is in kB. If "--realmem" is not provided at
CLI, totalmem() returns number in MB and the "firmware/hardware"
amount will be minus. totalmem() needs to always return value in kB.

Here is how to test this patch:
(1) Do "smem -w" , the "firmware/hardware" amount should not be minus.
(2) Do "smem -w -R 2001844kB" (change 2001844kB per your PC, note to
keep it in kB unit) , the "firmware/hardware" amount should not be
minus.

Here's a patch to fix these issues.
2009-05-14 22:08:38 -05:00
Jeff Schroeder
52848c0efb Kernel version >= 2.6.27 check
Awesome tool! I learned about this from the LWN article and
immediately (stupidly) tried it out on a centos 5 host. Here is a
patch to add a kernel version check.
2009-04-30 20:04:20 -05:00
Matt Mackall
aab32ae9de Add GPLv2+ license and copyright notice 2009-04-30 11:57:52 -05:00
Matt Mackall
91a412f622 Added tag 0.1 for changeset f168a8d93ec6 2009-04-07 15:17:19 -07:00
Matt Mackall
8adb875a88 catch keyboard interrupts 0.1 2009-04-07 15:14:11 -07:00
Matt Mackall
cd9a831067 Add x labels to bar chart 2009-04-07 15:10:28 -07:00
Matt Mackall
49fe263577 allow -c list, fix bar colors 2009-04-07 14:59:41 -07:00
Matt Mackall
983598c5b0 fix-ups for system view 2009-04-07 11:19:47 -07:00
Matt Mackall
90f16294c7 Add -w system reporting mode 2009-04-07 01:46:22 -07:00
Matt Mackall
88cd5c32e6 Add basic bar chart support 2009-04-07 00:24:39 -07:00
Matt Mackall
37546c5021 break pie chart into separate function 2009-04-06 23:19:46 -07:00
Matt Mackall
a7879677dd add column help 2009-04-06 23:11:36 -07:00
Matt Mackall
589c0de53f change count to pids in map view 2009-04-06 22:50:44 -07:00
Matt Mackall
000c1e0689 Add reading from alternate directory and tarball and example capture script 2009-04-06 22:48:01 -07:00
Matt Mackall
a7aa17b484 remove apss and friends, improve avgpss, add pids 2009-04-06 22:00:51 -07:00
Matt Mackall
8bb4790020 Basic pie chart support 2009-04-05 16:23:34 -05:00
Matt Mackall
40b49768d6 Abstract proc interface 2009-04-04 16:33:00 -05:00
Matt Mackall
d3d4c72f1f Kill empty listings when using -M 2009-04-03 16:50:19 -05:00
Matt Mackall
37261bad86 Add filtering, and vss, avgpss, avguss, and avgrss for maps 2009-04-03 16:34:04 -05:00
Matt Mackall
75829efd67 Add map counts 2009-04-02 02:07:17 -05:00
Matt Mackall
4aacfb5a99 Add VSS, ARSS, AUSS, and APSS. 2009-04-01 21:25:13 -05:00