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

[Xen-devel] [PATCH v4 7/9] xenalyze: handle more events in sched_process



Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/xentrace/xenalyze.c | 75 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 68 insertions(+), 7 deletions(-)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 0566d00..2300348 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -30,6 +30,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <public/trace.h>
+#include <public/sched.h>
 #include "analyze.h"
 #include "mread.h"
 #include "pv.h"
@@ -7569,24 +7570,84 @@ void sched_summary_domain(struct domain_data *d)
     }
 }
 
+void sched_class(struct record_info *ri)
+{
+    /* Just a stub for now */
+}
 
 void sched_process(struct pcpu_info *p)
 {
     struct record_info *ri = &p->ri;
 
-    if(ri->evt.sub == 0xf) {
+    if (ri->evt.sub == 1) {
+        sched_runstate_process(p);
+    } else if (ri->evt.sub == 2) {
+        sched_class(ri);
+    } else {
         switch(ri->event)
         {
+        case TRC_SCHED_DOM_ADD:
+            printf(" %s sched_add_domain d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_DOM_REM:
+            printf(" %s sched_rem_domain d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_SLEEP:
+            printf(" %s domain_sleep d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_WAKE:
+            printf(" %s domain_wake d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_YIELD:
+            printf(" %s do_yield d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_BLOCK:
+            printf(" %s do_block d%uv%u\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_SHUTDOWN:
+        {
+            static const char *reason[] = {
+                [SHUTDOWN_poweroff] = "poweroff",
+                [SHUTDOWN_reboot] = "reboot",
+                [SHUTDOWN_suspend] = "suspend",
+                [SHUTDOWN_crash] = "crash",
+                [SHUTDOWN_watchdog] = "watchdog",
+            };
+            printf(" %s domain_shutdown d%uv%u reason %x (%s)\n",
+                   ri->dump_header, ri->d[0], ri->d[1], ri->d[2],
+                   ri->d[2] > SHUTDOWN_MAX ? "unknown" : reason[ri->d[2]]);
+            break;
+        }
+        case TRC_SCHED_SHUTDOWN_CODE:
+        {
+            printf(" %s domain_shutdown_code d%uv%u reason %x\n",
+                   ri->dump_header, ri->d[0], ri->d[1], ri->d[2]);
+            break;
+        }
+        case TRC_SCHED_ADJDOM:
+            printf(" %s sched_adjdom domid d%u\n",
+                   ri->dump_header, ri->d[0]);
+            break;
         case TRC_SCHED_SWITCH:
             sched_switch_process(p);
             break;
+        case TRC_SCHED_SWITCH_INFPREV:
+            printf(" %s switch_infprev old_domid %x runtime %d\n",
+                   ri->dump_header, ri->d[0], ri->d[1]);
+            break;
+        case TRC_SCHED_SWITCH_INFNEXT:
+            printf(" %s switch_infnext new_domid %x time %d r_time %d\n",
+                   ri->dump_header, ri->d[0], ri->d[1], ri->d[2]);
+            break;
         default:
-            process_generic(&p->ri);
-        }
-    } else {
-        if(ri->evt.sub == 1)
-            sched_runstate_process(p);
-        else {
+            fprintf(warn, "%s: event:%x (min:%x sub:%x main:%x)\n",
+                    __func__, ri->event, ri->evt.minor, ri->evt.sub, 
ri->evt.main);
             UPDATE_VOLUME(p, sched_verbose, ri->size);
             process_generic(&p->ri);
         }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.