Commit graph

82 commits

Author SHA1 Message Date
Oren Tirosh
61f38b4268 py3: do not use "except Exception, e:" syntax
If catching the exception is done with "except Exception as e:" this
will work only from 2.6. To maintain backward compatibility with 2.4 I
have used sys.exc_info(). A bit of a wart, but it works.
2015-05-15 12:52:02 -05:00
Oren Tirosh
8c443fb8cc py3: add () to print statements
It's a function call in 3.x and redundant parentheses around an
expression on 2.x. This works fine as long as all prints have just a
single argument. One print statement with two arguments was changed to
use % formatting instead.
2015-05-15 12:50:59 -05:00
Oren Tirosh
db81ae6756 py3: stop using iterkeys() 2015-05-15 12:49:06 -05:00
Cybjit
e692903c47 smem: allow column auto-sizing 2014-11-18 20:01:16 -06:00
Cybjit
5b3c5b37dc showfields: complain about sets 2014-11-18 16:26:12 -06:00
Matt Mackall
7143f141f6 rename filter to filters to make 2to3 happy 2014-07-15 01:33:26 -05:00
Matt Mackall
7aea9744b1 switch file() to open() 2014-05-22 17:04:26 -05:00
Matt Mackall
1c597a8c30 Added tag 1.4 for changeset e143c8fdb6f5 2013-11-20 15:57:07 -05:00
Matt Mackall
3a9f167aa4 handle division by zero with no swap
Reported by Stefan Praszalowicz
2013-05-08 14:21:28 -05:00
Matt Mackall
03232fc735 drop unused import of grp 2013-04-22 17:21:03 -05:00
Matt Mackall
8803680aba Added tag 1.3 for changeset ee281c13f31d 2013-03-27 20:02:06 -07:00
Lo?c Minier
f5bc0c61b3 avoid bogus warning on PSS measurement with empty smaps files 2013-03-27 20:01:07 -07:00
Matt Mackall
d3a7e5107a fix handling of new fields in smaps
reported by Loic Minier
2013-02-22 14:03:46 -06:00
Jani Monoses
2e564d5b2b drop trailing slashes when looking up user/group in tar snapshots 2012-11-08 14:25:42 -06:00
Matt Mackall
e405e30d3f update COPYING for FSF address change 2012-10-29 14:59:55 -05:00
Matt Mackall
aa6515c114 Added tag 1.2 for changeset 43b299004079 2012-10-09 18:38:40 -05:00
Paul Townsend
df155c3b15 Fix percentage display for swap 2011-12-08 15:59:19 -06:00
Paul Townsend
4a835dff67 Count only filtered pids
If '-t' is specified and a filter such as '-U me' is specified, the
pid total displayed is the total number of pids instead of the number
of filtered pids.
2011-12-05 22:42:38 -06:00
Matt Mackall
952ae016d7 cache meminfo data 2011-12-05 14:55:39 -06:00
Matt Mackall
97b1d9b8a0 Added tag 1.1 for changeset 26f344c53f55 2011-11-30 14:57:46 -06:00
Matt Mackall
830285d7ba Be more forgiving of environment errors for memory and user views 2011-11-30 14:57:25 -06:00
Paul Townsend
e39d81ff24 Store uid/gid/mtime for /proc directory capture 2011-08-22 16:10:10 -05:00
Paul Townsend
ec190f2c00 Sort the output by "rss" when no "Pss" present in smaps. 2011-08-22 16:10:00 -05:00
Paul Townsend
b720424113 Properly convert uid/gid to string 2011-08-22 16:09:51 -05:00
Paul Townsend
273b0f9562 Grab uid info from /proc/<pid>/ stat 2011-08-22 16:09:17 -05:00
Paul Townsend
4701e3a741 Catch KeyError on uid and gid conversion 2011-08-17 17:16:21 -04:00
Matt Mackall
31daff485e Use /usr/bin/env to locate Python 2011-08-17 16:31:34 -05:00
Matt Mackall
0a86063d5b 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
1fe5bcb594 read process uid/gid from task rather than cmdline 2011-06-10 08:58:26 -05:00
Matt Mackall
f9a60fbe2e Add support for terabytes 2011-05-26 09:17:28 -05:00
Matt Mackall
f952ccbfb7 Added tag 1.0 for changeset 4f6b9d5b28e8 2011-02-16 16:26:56 -06:00
Tim Bird
2e8b8dadcf Fix bug in pie chart logic
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
7fe7133055 Clean up some tabs 2010-12-13 22:33:05 +01:00
Hynek Cernoch
8f9840718e Give hint about uncompressed kernels 2010-12-13 22:33:05 +01:00
Hynek Cernoch
39644bc6c2 Add note about --realmem usage to manpage 2010-12-13 22:33:05 +01:00
Hynek Cernoch
b0c7652ffd Fixed bug in realmem option 2010-12-13 22:33:05 +01:00
Yves Goergen
ba063a3a50 Avoid tracebacks on disappearing processes 2011-02-16 16:01:38 -06:00
Johannes Stezenbach
453a094e1b smemcap: fix compile warnings 2010-05-12 15:59:24 -05:00
Dean Peterson
2a12e25515 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?
2424b5aa9c 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
38e0c8ef3a Drop obsolete capture script 2010-03-29 16:19:21 -05:00
Matt Mackall
d7fd0ae5f7 Added tag 0.9 for changeset 708dd2e1b91a 2009-11-11 11:03:21 -06:00
lethargo
548d59833d add smem man page
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
5b9a248b9a Fix _ucache some more 2009-07-06 15:20:41 -05:00
Matt Mackall
af11718112 Fix references to _ucache and _gcache 2009-07-06 15:20:05 -05:00
Matt Mackall
6af3327b3d tar source: use usernames and groupnames from tarfile if available 2009-06-23 17:01:12 -05:00
Matt Mackall
95e4829829 Fix some tar header issues for smemcap 2009-06-08 15:15:37 -05:00
Matt Mackall
b3140a9a3d 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
365655364f add smemcap tool 2009-05-22 17:31:54 -05:00
Matt Mackall
3f0ffa8368 be less picky about tar directories 2009-05-22 17:29:51 -05:00