On Sat, 2008-08-23 at 21:31 +1000, James Cameron wrote:
> On Sat, Aug 23, 2008 at 12:01:07PM +0200, Marco Pesenti Gritti wrote:
> > On Fri, Aug 22, 2008 at 1:47 PM, James Cameron <[EMAIL PROTECTED]>
> wrote:
< ... >
> > Btw it's a shame that the python processes are grouped all together. I
> > wonder if we can fix ps_mem to show them separately, with the full
> > command.
> 
> I agree.
> 

The attached patch makes ps_mem show the process cmdline instead of its
name; it doesn't account for the /proc/[pid]/cmdline particular format
but output it's well readable.

riccardo
--- ps_mem.orig	2008-07-22 08:00:58.000000000 +0200
+++ ps_mem	2008-08-25 10:01:35.000000000 +0200
@@ -117,14 +117,16 @@
     return (Private, Shared)
 
 def getCmdName(pid):
-    cmd = file("/proc/%d/status" % pid).readline()[6:-1]
-    exe = os.path.basename(os.path.realpath("/proc/%d/exe" % pid))
-    if exe.startswith(cmd):
-        cmd=exe #show non truncated version
-        #Note because we show the non truncated name
-        #one can have separated programs as follows:
-        #584.0 KiB +   1.0 MiB =   1.6 MiB    mozilla-thunder (exe -> bash)
-        # 56.0 MiB +  22.2 MiB =  78.2 MiB    mozilla-thunderbird-bin
+    cmd = file("/proc/%d/cmdline" % pid).readline()[:60]
+    if not len(cmd):
+        cmd = file("/proc/%d/status" % pid).readline()[6:-1]
+        exe = os.path.basename(os.path.realpath("/proc/%d/exe" % pid))
+        if exe.startswith(cmd):
+            cmd=exe #show non truncated version
+            #Note because we show the non truncated name
+            #one can have separated programs as follows:
+            #584.0 KiB +   1.0 MiB =   1.6 MiB    mozilla-thunder (exe -> bash)
+            # 56.0 MiB +  22.2 MiB =  78.2 MiB    mozilla-thunderbird-bin
     return cmd
 
 cmds={}
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to