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

[Xen-devel] [PATCH] xenalyze: Break down "runnable" into "wake" and "preempt"



The "runnable" runstate can be reached either waiting for a cpu
when waking, or when preempted.  Keep track of these separate states
and report them under "runnable".

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 4e88187c91ba -r d8690ca24f39 xenalyze.c
--- a/xenalyze.c        Mon Nov 22 12:39:38 2010 +0000
+++ b/xenalyze.c        Wed Dec 01 09:52:58 2010 +0000
@@ -1520,6 +1520,21 @@
     [RUNSTATE_LOST]=    "lost",
 };
 
+enum {
+    RUNNABLE_STATE_INVALID,
+    RUNNABLE_STATE_WAKE,
+    RUNNABLE_STATE_PREEMPT,
+    RUNNABLE_STATE_OTHER,
+    RUNNABLE_STATE_MAX
+};
+
+char * runnable_state_name[RUNNABLE_STATE_MAX]={
+    [RUNNABLE_STATE_INVALID]="invalid", /* Should never show up */
+    [RUNNABLE_STATE_WAKE]="wake",
+    [RUNNABLE_STATE_PREEMPT]="preempt",
+    [RUNNABLE_STATE_OTHER]="other",
+};
+
 /* Memory data */
 enum {
     MEM_PAGE_GRANT_MAP = 1,
@@ -1596,6 +1611,7 @@
     /* Schedule info */
     struct {
         int state;
+        int runnable_state; /* Only valid when state==RUNSTATE_RUNNABLE */
         tsc_t tsc;
         /* TSC skew detection/correction */
         struct last_oldstate_struct {
@@ -1621,6 +1637,7 @@
     /* Summary info */
     struct cycle_framework f;
     struct cycle_summary runstates[RUNSTATE_MAX];
+    struct cycle_summary runnable_states[RUNNABLE_STATE_MAX];
     struct weighted_cpi_summary cpi;
     struct cycle_summary cpu_affinity_all,
         cpu_affinity_pcpu[MAX_CPUS];
@@ -4901,6 +4918,9 @@
         if(v->runstate.state == RUNSTATE_RUNNING)
             update_cycles(&v->d->total_time, tsc - v->runstate.tsc);
 
+        if(v->runstate.state == RUNSTATE_RUNNABLE)
+            update_cycles(v->runnable_states + v->runstate.runnable_state, tsc 
- v->runstate.tsc);
+
         /* How much did dom0 run this buffer? */
         if(v->d->did == 0) {
             int i;
@@ -4925,6 +4945,26 @@
             }
         }
     }
+
+    /* Detect "runnable" states */
+    if ( new_runstate == RUNSTATE_RUNNABLE )
+    {
+        switch(v->runstate.state)
+        {
+        case RUNSTATE_RUNNING:
+            v->runstate.runnable_state=RUNNABLE_STATE_PREEMPT;
+            break;
+        case RUNSTATE_BLOCKED:
+        case RUNSTATE_OFFLINE:
+            v->runstate.runnable_state=RUNNABLE_STATE_WAKE;
+            break;
+        default:
+            v->runstate.runnable_state=RUNNABLE_STATE_OTHER;
+            break;
+        }
+    } else
+        v->runstate.runnable_state=RUNNABLE_STATE_INVALID;
+
     v->runstate.state = new_runstate;
     v->runstate.tsc = tsc;
 
@@ -7257,6 +7297,16 @@
     for(i=0; i<RUNSTATE_MAX; i++) {
         snprintf(desc,30, "  %8s", runstate_name[i]); 
         print_cycle_summary(v->runstates+i, desc);
+        if ( i==RUNSTATE_RUNNABLE )
+        {
+            int j;
+            for(j=0; j<RUNNABLE_STATE_MAX; j++) {
+                if ( j == RUNNABLE_STATE_INVALID )
+                    continue;
+                snprintf(desc,30, "    %8s", runnable_state_name[j]); 
+                print_cycle_summary(v->runnable_states+j, desc);
+            }
+        }
     }
     print_cpi_summary(&v->cpi);
     print_cpu_affinity(&v->cpu_affinity_all, " cpu affinity");

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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