[CalendarServer-changes] [6885] CalendarServer/trunk/contrib/tools/request_monitor.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 4 16:36:05 PST 2011


Revision: 6885
          http://trac.macosforge.org/projects/calendarserver/changeset/6885
Author:   dre at apple.com
Date:     2011-02-04 16:36:03 -0800 (Fri, 04 Feb 2011)
Log Message:
-----------
Add % cpu per daemon

Modified Paths:
--------------
    CalendarServer/trunk/contrib/tools/request_monitor.py

Modified: CalendarServer/trunk/contrib/tools/request_monitor.py
===================================================================
--- CalendarServer/trunk/contrib/tools/request_monitor.py	2011-02-04 22:26:04 UTC (rev 6884)
+++ CalendarServer/trunk/contrib/tools/request_monitor.py	2011-02-05 00:36:03 UTC (rev 6885)
@@ -77,7 +77,22 @@
     output, _ignore_error = child.communicate()
     return output.split("\n")
 
+def cpuPerDaemon():
+    a = []
+    child = Popen(
+        args=[
+            "ps", "auxw",
+        ],
+        stdout=PIPE, stderr=STDOUT,
+    )
+    output, _ignore_ = child.communicate()
+    for l in output.split("\n"):
+        if "ProcessType=" in l:
+            f = l.split()
+            a.append(f[2])
+    return ", ".join(a)
 
+
 def cpuidle():
     child = Popen(
         args=[
@@ -380,6 +395,7 @@
         q = idleHistory()
         print "CPU idle %:", q[0], " (Recent", ", ".join(q[1:]), "Oldest)"
         print "Memory free:", freemem()
+        print "CPU Per Daemon:", cpuPerDaemon()
 
         if avg:
             print avg, "|",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110204/aa26afaf/attachment.html>


More information about the calendarserver-changes mailing list