Skip to contentSkip to conversation

xentrace: trace when we continue with the same task

PATCH New George Dunlap 1 participant 1 message Mar 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xentrace: trace when we continue with the same task

Trace when the scheduler decides to continue running the same process.
This lets us see that this is happening for one; it also lets us see
domains in a trace which are actively running on pcpu but never scheduled out.

xen/common/schedule.c +15 -0
diff -r 4ac8bc60c000 xen/common/schedule.c
@@ -79,6 +79,20 @@
     event |= ( new_state & 0x3 ) << 4;
 
     __trace_var(event, 1/*tsc*/, sizeof(d), (unsigned char *)&d);
+}
+
+static inline void trace_continue_running(struct vcpu *v)
+{
+    struct { uint32_t vcpu:16, domain:16; } d;
+
+    if ( likely(!tb_init_done) )
+        return;
+
+    d.vcpu = v->vcpu_id;
+    d.domain = v->domain->domain_id;
+
+    __trace_var(TRC_SCHED_CONTINUE_RUNNING, 1/*tsc*/, sizeof(d),
+                (unsigned char *)&d);
 }
 
 static inline void vcpu_runstate_change(
@@ -803,6 +817,7 @@
     if ( unlikely(prev == next) )
     {
         spin_unlock_irq(&sd->schedule_lock);
+        trace_continue_running(next);
         return continue_running(prev);
     }
 
xen/include/public/trace.h +2 -1
diff -r 4ac8bc60c000 xen/include/public/trace.h
@@ -60,7 +60,8 @@
 #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
 #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
 
-#define TRC_SCHED_RUNSTATE_CHANGE (TRC_SCHED_MIN + 1)
+#define TRC_SCHED_RUNSTATE_CHANGE   (TRC_SCHED_MIN + 1)
+#define TRC_SCHED_CONTINUE_RUNNING  (TRC_SCHED_MIN + 2)
 #define TRC_SCHED_DOM_ADD        (TRC_SCHED_VERBOSE +  1)
 #define TRC_SCHED_DOM_REM        (TRC_SCHED_VERBOSE +  2)
 #define TRC_SCHED_SLEEP          (TRC_SCHED_VERBOSE +  3)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel