# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1220885433 -3600
# Node ID 0e3df63b993259263ca78f11bd0955e7055bb180
# Parent 1a7705924dbe5c55139d64783794bd7a130cfb41
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@xxxxxxxxxxxxx>
Signed-off-by: Trolle Selander <trolle.selander@xxxxxxxxxxxxx>
---
xen/common/trace.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff -r 1a7705924dbe -r 0e3df63b9932 xen/common/trace.c
--- a/xen/common/trace.c Mon Sep 08 15:47:47 2008 +0100
+++ b/xen/common/trace.c Mon Sep 08 15:50:33 2008 +0100
@@ -58,6 +58,7 @@ static int t_buf_highwater;
/* Number of records lost due to per-CPU trace buffer being full. */
static DEFINE_PER_CPU(unsigned long, lost_records);
+static DEFINE_PER_CPU(unsigned long, lost_records_first_tsc);
/* a flag recording whether initialization has been done */
/* or more properly, if the tbuf subsystem is enabled right now */
@@ -354,22 +355,27 @@ static inline int insert_wrap_record(str
NULL);
}
-#define LOST_REC_SIZE 8
+#define LOST_REC_SIZE (4 + 8 + 16) /* header + tsc + sizeof(struct ed) */
static inline int insert_lost_records(struct t_buf *buf)
{
struct {
u32 lost_records;
- } ed;
-
+ u32 did:16, vid:16;
+ u64 first_tsc;
+ } __attribute__((packed)) ed;
+
+ ed.vid = current->vcpu_id;
+ ed.did = current->domain->domain_id;
ed.lost_records = this_cpu(lost_records);
+ ed.first_tsc = this_cpu(lost_records_first_tsc);
this_cpu(lost_records) = 0;
return __insert_record(buf,
TRC_LOST_RECORDS,
sizeof(ed),
- 0 /* !cycles */,
+ 1 /* cycles */,
LOST_REC_SIZE,
(unsigned char *)&ed);
}
@@ -479,7 +485,8 @@ void __trace_var(u32 event, int cycles,
/* Do we have enough space for everything? */
if ( total_size > bytes_to_tail )
{
- this_cpu(lost_records)++;
+ if ( ++this_cpu(lost_records) == 1 )
+ this_cpu(lost_records_first_tsc)=(u64)get_cycles();
local_irq_restore(flags);
return;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|