Commit graph

53 commits

Author SHA1 Message Date
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
Tim Bird
b78ae87d6b 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.
8f77f323fa 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
Matt Mackall
705ba5f79c Add totalmem, --realmem, fromunits, and percentage output 2009-04-01 18:56:37 -05:00
Matt Mackall
7a4509a3c5 Add kernel thread filtering, unit display 2009-03-27 23:39:53 -05:00
Matt Mackall
9448f7cb2e Add user view 2009-03-27 20:43:35 -05:00
Matt Mackall
09d7939030 Get maps view working 2009-03-27 13:10:36 -05:00
Matt Mackall
f411af9d30 Add some command line options 2009-03-26 17:14:49 -05:00