ia64/xen-unstable

changeset 18450:1a7705924dbe

xentrace 1/7: Trace runstate changes.

Also, introduce SCHED_MIN and SCHED_VERBOSE, so that we can trace
just runstate changes if we want to.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 08 15:47:47 2008 +0100 (2008-09-08)
parents 10c630645d13
children 0e3df63b9932
files xen/common/schedule.c xen/include/public/trace.h
line diff
     1.1 --- a/xen/common/schedule.c	Mon Sep 08 14:01:35 2008 +0100
     1.2 +++ b/xen/common/schedule.c	Mon Sep 08 15:47:47 2008 +0100
     1.3 @@ -63,12 +63,32 @@ static struct scheduler ops;
     1.4           (( ops.fn != NULL ) ? ops.fn( __VA_ARGS__ )      \
     1.5            : (typeof(ops.fn(__VA_ARGS__)))0 )
     1.6  
     1.7 +static inline void trace_runstate_change(struct vcpu *v, int new_state)
     1.8 +{
     1.9 +    struct { uint32_t vcpu:16, domain:16; } d;
    1.10 +    uint32_t event;
    1.11 +
    1.12 +    if ( likely(!tb_init_done) )
    1.13 +        return;
    1.14 +
    1.15 +    d.vcpu = v->vcpu_id;
    1.16 +    d.domain = v->domain->domain_id;
    1.17 +
    1.18 +    event = TRC_SCHED_RUNSTATE_CHANGE;
    1.19 +    event |= ( v->runstate.state & 0x3 ) << 8;
    1.20 +    event |= ( new_state & 0x3 ) << 4;
    1.21 +
    1.22 +    __trace_var(event, 1/*tsc*/, sizeof(d), (unsigned char *)&d);
    1.23 +}
    1.24 +
    1.25  static inline void vcpu_runstate_change(
    1.26      struct vcpu *v, int new_state, s_time_t new_entry_time)
    1.27  {
    1.28      ASSERT(v->runstate.state != new_state);
    1.29      ASSERT(spin_is_locked(&per_cpu(schedule_data,v->processor).schedule_lock));
    1.30  
    1.31 +    trace_runstate_change(v, new_state);
    1.32 +
    1.33      v->runstate.time[v->runstate.state] +=
    1.34          new_entry_time - v->runstate.state_entry_time;
    1.35      v->runstate.state_entry_time = new_entry_time;
     2.1 --- a/xen/include/public/trace.h	Mon Sep 08 14:01:35 2008 +0100
     2.2 +++ b/xen/include/public/trace.h	Mon Sep 08 15:47:47 2008 +0100
     2.3 @@ -50,26 +50,30 @@
     2.4  #define TRC_HVM_ENTRYEXIT 0x00081000   /* VMENTRY and #VMEXIT       */
     2.5  #define TRC_HVM_HANDLER   0x00082000   /* various HVM handlers      */
     2.6  
     2.7 +#define TRC_SCHED_MIN       0x00021000   /* Just runstate changes */
     2.8 +#define TRC_SCHED_VERBOSE   0x00028000   /* More inclusive scheduling */
     2.9 +
    2.10  /* Trace events per class */
    2.11  #define TRC_LOST_RECORDS        (TRC_GEN + 1)
    2.12  #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
    2.13  #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
    2.14  
    2.15 -#define TRC_SCHED_DOM_ADD       (TRC_SCHED +  1)
    2.16 -#define TRC_SCHED_DOM_REM       (TRC_SCHED +  2)
    2.17 -#define TRC_SCHED_SLEEP         (TRC_SCHED +  3)
    2.18 -#define TRC_SCHED_WAKE          (TRC_SCHED +  4)
    2.19 -#define TRC_SCHED_YIELD         (TRC_SCHED +  5)
    2.20 -#define TRC_SCHED_BLOCK         (TRC_SCHED +  6)
    2.21 -#define TRC_SCHED_SHUTDOWN      (TRC_SCHED +  7)
    2.22 -#define TRC_SCHED_CTL           (TRC_SCHED +  8)
    2.23 -#define TRC_SCHED_ADJDOM        (TRC_SCHED +  9)
    2.24 -#define TRC_SCHED_SWITCH        (TRC_SCHED + 10)
    2.25 -#define TRC_SCHED_S_TIMER_FN    (TRC_SCHED + 11)
    2.26 -#define TRC_SCHED_T_TIMER_FN    (TRC_SCHED + 12)
    2.27 -#define TRC_SCHED_DOM_TIMER_FN  (TRC_SCHED + 13)
    2.28 -#define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED + 14)
    2.29 -#define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED + 15)
    2.30 +#define TRC_SCHED_RUNSTATE_CHANGE (TRC_SCHED_MIN + 1)
    2.31 +#define TRC_SCHED_DOM_ADD        (TRC_SCHED_VERBOSE +  1)
    2.32 +#define TRC_SCHED_DOM_REM        (TRC_SCHED_VERBOSE +  2)
    2.33 +#define TRC_SCHED_SLEEP          (TRC_SCHED_VERBOSE +  3)
    2.34 +#define TRC_SCHED_WAKE           (TRC_SCHED_VERBOSE +  4)
    2.35 +#define TRC_SCHED_YIELD          (TRC_SCHED_VERBOSE +  5)
    2.36 +#define TRC_SCHED_BLOCK          (TRC_SCHED_VERBOSE +  6)
    2.37 +#define TRC_SCHED_SHUTDOWN       (TRC_SCHED_VERBOSE +  7)
    2.38 +#define TRC_SCHED_CTL            (TRC_SCHED_VERBOSE +  8)
    2.39 +#define TRC_SCHED_ADJDOM         (TRC_SCHED_VERBOSE +  9)
    2.40 +#define TRC_SCHED_SWITCH         (TRC_SCHED_VERBOSE + 10)
    2.41 +#define TRC_SCHED_S_TIMER_FN     (TRC_SCHED_VERBOSE + 11)
    2.42 +#define TRC_SCHED_T_TIMER_FN     (TRC_SCHED_VERBOSE + 12)
    2.43 +#define TRC_SCHED_DOM_TIMER_FN   (TRC_SCHED_VERBOSE + 13)
    2.44 +#define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED_VERBOSE + 14)
    2.45 +#define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15)
    2.46  
    2.47  #define TRC_MEM_PAGE_GRANT_MAP      (TRC_MEM + 1)
    2.48  #define TRC_MEM_PAGE_GRANT_UNMAP    (TRC_MEM + 2)