From: Pekka Paalanen <pq@iki.fi>
To: Ingo Molnar <mingo@elte.hu>
Cc: Pekka Paalanen <pq@iki.fi>, Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, akpm@osdl.org,
Peter Zijlstra <peterz@infradead.org>,
Soeren Sandmann Pedersen <sandmann@redhat.com>,
Steven Rostedt <srostedt@redhat.com>,
Pavel Roskin <proski@gnu.org>
Subject: [PATCH 3/5] mmiotrace: print overrun counts
Date: Sun, 27 Apr 2008 22:37:08 +0300 [thread overview]
Message-ID: <20080427223708.2137ba95@daedalus.pq.iki.fi> (raw)
In-Reply-To: <20080427222925.02b2b27b@daedalus.pq.iki.fi>
>From d5c3a38d48e223bcf192f48a8b202fdffa616390 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sun, 27 Apr 2008 00:00:33 +0300
Subject: [PATCH] mmiotrace: print overrun counts
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
kernel/trace/trace_mmiotrace.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index 6d2edbd..d0f649a 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -17,11 +17,13 @@ struct header_iter {
};
static struct trace_array *mmio_trace_array;
+static bool overrun_detected;
static void mmio_reset_data(struct trace_array *tr)
{
int cpu;
+ overrun_detected = false;
tr->time_start = ftrace_now(tr->cpu);
for_each_online_cpu(cpu)
@@ -124,12 +126,34 @@ static void mmio_close(struct trace_iterator *iter)
iter->private = NULL;
}
+static unsigned long count_overruns(struct trace_iterator *iter)
+{
+ int cpu;
+ unsigned long cnt = 0;
+ for_each_online_cpu(cpu) {
+ cnt += iter->overrun[cpu];
+ iter->overrun[cpu] = 0;
+ }
+ return cnt;
+}
+
static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
char __user *ubuf, size_t cnt, loff_t *ppos)
{
ssize_t ret;
struct header_iter *hiter = iter->private;
struct trace_seq *s = &iter->seq;
+ unsigned long n;
+
+ n = count_overruns(iter);
+ if (n) {
+ /* XXX: This is later than where events were lost. */
+ trace_seq_printf(s, "MARK 0.000000 Lost %lu events.\n", n);
+ if (!overrun_detected)
+ pr_warning("mmiotrace has lost events.\n");
+ overrun_detected = true;
+ goto print_out;
+ }
if (!hiter)
return 0;
@@ -142,6 +166,7 @@ static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
iter->private = NULL;
}
+print_out:
ret = trace_seq_to_user(s, ubuf, cnt);
return (ret == -EBUSY) ? 0 : ret;
}
--
1.5.3.7
next prev parent reply other threads:[~2008-04-27 19:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-27 19:29 [PATCH 0/5] updates to ftrace framework and mmiotrace Pekka Paalanen
2008-04-27 19:33 ` [PATCH 1/5] ftrace: add readpos to struct trace_seq; add trace_seq_to_user() Pekka Paalanen
2008-04-27 19:35 ` [PATCH 2/5] mmiotrace: print header using the read hook Pekka Paalanen
2008-04-27 19:37 ` Pekka Paalanen [this message]
2008-04-27 19:39 ` [PATCH 4/5] mmiotrace: Do not print bogus pid for maps either Pekka Paalanen
2008-04-27 19:40 ` [PATCH 5/5] doc: update mmiotrace doc to current status Pekka Paalanen
2008-04-28 13:21 ` [PATCH 0/5] updates to ftrace framework and mmiotrace Steven Rostedt
2008-04-28 13:29 ` Ingo Molnar
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=20080427223708.2137ba95@daedalus.pq.iki.fi \
--to=pq@iki.fi \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=proski@gnu.org \
--cc=rostedt@goodmis.org \
--cc=sandmann@redhat.com \
--cc=srostedt@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®