* Michal Čihař <ni...@debian.org> [20100102 11:35]:
> Dne Thu, 31 Dec 2009 10:51:14 +0100
> Michael Prokop <m...@debian.org> napsal(a):
> > * Michal Čihař <ni...@debian.org> [20091231 08:31]:
> > > Dne Wed, 30 Dec 2009 23:33:43 +0100
> > > Michael Prokop <m...@debian.org> napsal(a):

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

> > > It works for me. Can you please create snapshot of proc data smem uses
> > > by using /usr/share/doc/smem/examples/capture script and send it to me?

> > Available at http://grml.org/tmp/smem_kvm.tgz
> > sha1: cc708a3443aeb54a40781fe74d91cea0b40dd989
> > (It's a kvm session with 512 MB of memory.)

> Unfortunately I can't reproduce your problem with this snapshot.

Ok, I took a closer look at it.

It's about the resolution of the .02 value:

|  while values and (t + values[-1 - c] < (tm * .02) or
|                                               ^^^

If I change the .02 to something lower like .005 it works.

Variable tm (:= total memory) corresponds to 511964 kbytes on my
system. So 2% of it are ~10239 kbytes. I don't have any processes
which consume more than those ~10239 kbytes of PSS on my testbed.
That's why the access to the list fails at some point during
iteration.

Dynamic percentage calculation for the resolution of what should be
displayed should fix this issue. A trivial patch which addresses the
issue for me (please consider asking upstream about it, it's really
just a quick hack that upstream might want to check/modify/improve):

@@ -495,8 +495,7 @@
     unused = tm - s
     t = 0
     c = 0
-    job_percentage = max(values) / (tm * 1.0)
-    while values and (t + values[-1 - c] < (tm * job_percentage) or
+    while values and (t + values[-1 - c] < (tm * .02) or
                       values[-1 - c] < (tm * .005)):
         c += 1
         t += values.pop()


If you want to reproduce the issue on your own you can grab a daily
snapshot from http://daily.grml.org/grml-medium_sid/ and execute
"kvm -k en_us -m 512 -k en-us -cdrom ./grml-medium_sid_2010*.iso"
Just start X ('grml-x fluxbox' on tty5 for example) and execute
'sudo apt-get update ; sudo apt-get install smem python-tk python-matplotlib'.

regards,
-mika-

Attachment: signature.asc
Description: Digital signature

Reply via email to