[gnome-talos] report: Fix system/user being backwards, separate self



commit 1346245b8efddd66f4e43e3eed659f6736fe44c1
Author: Colin Walters <walters verbum org>
Date:   Mon Sep 26 08:01:09 2011 -0400

    report: Fix system/user being backwards, separate self

 src/report.html |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/report.html b/src/report.html
index 0333687..efa1c63 100644
--- a/src/report.html
+++ b/src/report.html
@@ -26,22 +26,26 @@
     <script type="text/javascript">
       var data = @DATA@;
 
-      function getRSSForSnapshot(snapshot) {
+      function getRSSForSnapshot(snapshot, myPid) {
         var meta = snapshot[0];
         var processes = snapshot[1].processes[0];
+        var self = 0;
         var system = 0;
         var user = 0;
 
         for (var pid in processes) {
           var process = processes[pid];
+          var rss = process['rss'];
           var real_uid = process['real-uid'];
-          if (real_uid >= 500) 
-            system += process['rss'];
-          else
+          if (pid == myPid)
+            self = rss;
+          else if (real_uid >= 500) 
             user += process['rss'];
+          else
+            system += process['rss'];
         }
         
-        return [system, user];
+        return [system, user, self];
       }
  
       $(document).ready(function () {
@@ -50,12 +54,15 @@
 
         var systemRSS = [];
         var userRSS = [];
+        var selfRSS = [];
         for (var i = 1; i < data.length; i++) {
           var rssData = getRSSForSnapshot(data[i]);
           systemRSS.push([i, rssData[0]]);
           userRSS.push([i, rssData[1]]);
+          selfRSS.push([i, rssData[2]]);
         }
-      $.plot($("#rss-graph"), [ { label: 'System RSS', data: systemRSS }, { label: 'User RSS', data: userRSS } ]);
+      $.plot($("#rss-graph"), [ { label: 'System RSS', data: systemRSS }, { label: 'User RSS', data: userRSS },
+			        { label: 'Talos RSS', data: selfRSS } ]);
      });
     </script>
   </head>
@@ -63,6 +70,7 @@
     <h1>Report for @SRC_FILE@:</h1>
     <p><tt>System UUID: <span id="system-uuid"></span></tt></p>
     <p><tt>System Total RAM: <span id="system-ram"></span></tt></p>
+    <h3>RSS</h3>
     <div id="rss-graph" style="width:800px;height:500px;"></div>
   </body>
 </html>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]