xentrace: trace when we continue with the same task
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 15:01:34 +0000 (15:01 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Mar 2009 15:01:34 +0000 (15:01 +0000)
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.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/schedule.c
xen/include/public/trace.h

index aed123b2af19c7643f0fc039573a4a7c695aa3be..99f57a232d470da5e55374e2e0894bdc63627315 100644 (file)
@@ -81,6 +81,20 @@ static inline void trace_runstate_change(struct vcpu *v, int new_state)
     __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(
     struct vcpu *v, int new_state, s_time_t new_entry_time)
 {
@@ -803,6 +817,7 @@ static void schedule(void)
     if ( unlikely(prev == next) )
     {
         spin_unlock_irq(&sd->schedule_lock);
+        trace_continue_running(next);
         return continue_running(prev);
     }
 
index e2d8adc7b4a8cb62b4f1c6616b8a004763996743..83e09f3b593f21b50481e3c20fa8dc6f482ed520 100644 (file)
@@ -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)