ia64/xen-unstable

changeset 18451:0e3df63b9932

xentrace 2/7: Lost-records record includes currently running vcpu,
and tsc of first lost record.

Including the current vcpu helps us identify who's currently
running on each processor, even if we've lost records. The tsc of the
first lost record helps us identify how much time we've spent lost,
and also when a pcpu started experiencing lost records.

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:50:33 2008 +0100 (2008-09-08)
parents 1a7705924dbe
children 1abe2bf8c0fa
files xen/common/trace.c
line diff
     1.1 --- a/xen/common/trace.c	Mon Sep 08 15:47:47 2008 +0100
     1.2 +++ b/xen/common/trace.c	Mon Sep 08 15:50:33 2008 +0100
     1.3 @@ -58,6 +58,7 @@ static int t_buf_highwater;
     1.4  
     1.5  /* Number of records lost due to per-CPU trace buffer being full. */
     1.6  static DEFINE_PER_CPU(unsigned long, lost_records);
     1.7 +static DEFINE_PER_CPU(unsigned long, lost_records_first_tsc);
     1.8  
     1.9  /* a flag recording whether initialization has been done */
    1.10  /* or more properly, if the tbuf subsystem is enabled right now */
    1.11 @@ -354,22 +355,27 @@ static inline int insert_wrap_record(str
    1.12                      NULL);
    1.13  }
    1.14  
    1.15 -#define LOST_REC_SIZE 8
    1.16 +#define LOST_REC_SIZE (4 + 8 + 16) /* header + tsc + sizeof(struct ed) */
    1.17  
    1.18  static inline int insert_lost_records(struct t_buf *buf)
    1.19  {
    1.20      struct {
    1.21          u32 lost_records;
    1.22 -    } ed;
    1.23 +        u32 did:16, vid:16;
    1.24 +        u64 first_tsc;
    1.25 +    } __attribute__((packed)) ed;
    1.26  
    1.27 +    ed.vid = current->vcpu_id;
    1.28 +    ed.did = current->domain->domain_id;
    1.29      ed.lost_records = this_cpu(lost_records);
    1.30 +    ed.first_tsc = this_cpu(lost_records_first_tsc);
    1.31  
    1.32      this_cpu(lost_records) = 0;
    1.33  
    1.34      return __insert_record(buf,
    1.35                             TRC_LOST_RECORDS,
    1.36                             sizeof(ed),
    1.37 -                           0 /* !cycles */,
    1.38 +                           1 /* cycles */,
    1.39                             LOST_REC_SIZE,
    1.40                             (unsigned char *)&ed);
    1.41  }
    1.42 @@ -479,7 +485,8 @@ void __trace_var(u32 event, int cycles, 
    1.43      /* Do we have enough space for everything? */
    1.44      if ( total_size > bytes_to_tail )
    1.45      {
    1.46 -        this_cpu(lost_records)++;
    1.47 +        if ( ++this_cpu(lost_records) == 1 )
    1.48 +            this_cpu(lost_records_first_tsc)=(u64)get_cycles();
    1.49          local_irq_restore(flags);
    1.50          return;
    1.51      }