All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Gardner <rob.gardner@hp.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] xentrace: new trace event to track lost trace records
Date: Thu, 06 Jul 2006 17:35:00 -0600	[thread overview]
Message-ID: <44AD9E24.9050808@hp.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]

Simple addition to trace.c to count trace records that are generated 
when the trace buffers are full. When there is space available again, a 
new record is generated that indicates how many trace records have been 
thrown away. I'm working on the corresponding userland code to do 
something useful with this information, and will send out an additional 
patch 'soon.'

Rob Gardner

# HG changeset patch
# User rob.gardner@hp.com
# Node ID 81e7d6e0f9109bf493b7c8281ffc79d10f4dd2ab
# Parent  67f658b84025efeb2a570d2937ebc8f5e35056f7

New trace event is introduced to track lost trace records.

diff -r 67f658b84025 -r 81e7d6e0f910 xen/common/trace.c
--- a/xen/common/trace.c    Thu Jul  6 18:08:37 2006
+++ b/xen/common/trace.c    Thu Jul  6 23:29:26 2006
@@ -234,7 +234,8 @@
     struct t_buf *buf;
     struct t_rec *rec;
     unsigned long flags;
-
+    static long lost_records = 0;
+   
     BUG_ON(!tb_init_done);
 
     if ( (tb_event_mask & event) == 0 )
@@ -261,8 +262,24 @@
 
     if ( (buf->prod - buf->cons) >= nr_recs )
     {
+        lost_records++;
         local_irq_restore(flags);
         return;
+    }
+
+    if (lost_records) {
+        rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
+        rec->cycles  = (u64)get_cycles();
+        rec->event   = TRC_LOST_RECORDS;
+        rec->data[0] = lost_records;
+        rec->data[1] = 0;
+        rec->data[2] = 0;
+        rec->data[3] = 0;
+        rec->data[4] = 0;
+       
+        wmb();
+        buf->prod++;
+        lost_records = 0;
     }
 
     rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
diff -r 67f658b84025 -r 81e7d6e0f910 xen/include/public/trace.h
--- a/xen/include/public/trace.h    Thu Jul  6 18:08:37 2006
+++ b/xen/include/public/trace.h    Thu Jul  6 23:29:26 2006
@@ -26,6 +26,7 @@
 #define TRC_VMXIO    0x00088000   /* VMX io emulation trace  */
 
 /* Trace events per class */
+#define TRC_LOST_RECORDS        (TRC_GEN + 1)
 
 #define TRC_SCHED_DOM_ADD       (TRC_SCHED +  1)
 #define TRC_SCHED_DOM_REM       (TRC_SCHED +  2)


[-- Attachment #2: trace-patch --]
[-- Type: text/plain, Size: 1647 bytes --]

# HG changeset patch
# User rob.gardner@hp.com
# Node ID 81e7d6e0f9109bf493b7c8281ffc79d10f4dd2ab
# Parent  67f658b84025efeb2a570d2937ebc8f5e35056f7

New trace event is introduced to track lost trace records.

diff -r 67f658b84025 -r 81e7d6e0f910 xen/common/trace.c
--- a/xen/common/trace.c	Thu Jul  6 18:08:37 2006
+++ b/xen/common/trace.c	Thu Jul  6 23:29:26 2006
@@ -234,7 +234,8 @@
     struct t_buf *buf;
     struct t_rec *rec;
     unsigned long flags;
-
+    static long lost_records = 0;
+    
     BUG_ON(!tb_init_done);
 
     if ( (tb_event_mask & event) == 0 )
@@ -261,8 +262,24 @@
 
     if ( (buf->prod - buf->cons) >= nr_recs )
     {
+        lost_records++;
         local_irq_restore(flags);
         return;
+    }
+
+    if (lost_records) {
+        rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
+        rec->cycles  = (u64)get_cycles();
+        rec->event   = TRC_LOST_RECORDS;
+        rec->data[0] = lost_records;
+        rec->data[1] = 0;
+        rec->data[2] = 0;
+        rec->data[3] = 0;
+        rec->data[4] = 0;
+        
+        wmb();
+        buf->prod++;
+        lost_records = 0;
     }
 
     rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
diff -r 67f658b84025 -r 81e7d6e0f910 xen/include/public/trace.h
--- a/xen/include/public/trace.h	Thu Jul  6 18:08:37 2006
+++ b/xen/include/public/trace.h	Thu Jul  6 23:29:26 2006
@@ -26,6 +26,7 @@
 #define TRC_VMXIO    0x00088000   /* VMX io emulation trace  */
 
 /* Trace events per class */
+#define TRC_LOST_RECORDS        (TRC_GEN + 1)
 
 #define TRC_SCHED_DOM_ADD       (TRC_SCHED +  1)
 #define TRC_SCHED_DOM_REM       (TRC_SCHED +  2)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2006-07-06 23:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 23:35 Rob Gardner [this message]
2006-08-18 13:20 ` [PATCH] xentrace: new trace event to track lost trace records Mark Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44AD9E24.9050808@hp.com \
    --to=rob.gardner@hp.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.