Development Team/Profiling

From Sugar Labs
< Development Team
Revision as of 04:50, 25 August 2008 by 87.17.111.85 (talk) (New page: <noinclude>{{ GoogleTrans-en | es =show | bg =show | zh-CN =show | zh-TW =show | hr =show | cs =show | da =show | nl =show | fi =show | fr =show | de =show | el =show | hi =show | it =show...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Memory

ps_mem

original script at http://www.pixelbeat.org/scripts/ps_mem.py
patched version at http://dev.laptop.org/~rlucchese/scripts/ps_mem
patch:
--- 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={}