From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
akpm@osdl.org, Peter Zijlstra <peterz@infradead.org>,
Soeren Sandmann Pedersen <sandmann@redhat.com>,
Pekka Paalanen <pq@iki.fi>, Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 1/3] ftrace: add logic to record overruns
Date: Mon, 21 Apr 2008 17:09:36 -0400 [thread overview]
Message-ID: <20080421212128.201844090@goodmis.org> (raw)
In-Reply-To: 20080421210935.460817943@goodmis.org
[-- Attachment #1: ftrace-account-overruns.patch --]
[-- Type: text/plain, Size: 3161 bytes --]
This patch sets up the infrastructure to record overruns of the tracing
buffer.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace.c | 16 +++++++++++-----
kernel/trace/trace.h | 6 +++++-
2 files changed, 16 insertions(+), 6 deletions(-)
Index: linux-sched-devel.git/kernel/trace/trace.c
===================================================================
--- linux-sched-devel.git.orig/kernel/trace/trace.c 2008-04-21 13:47:30.000000000 -0400
+++ linux-sched-devel.git/kernel/trace/trace.c 2008-04-21 14:39:43.000000000 -0400
@@ -612,6 +612,7 @@ void unregister_tracer(struct tracer *ty
void tracing_reset(struct trace_array_cpu *data)
{
data->trace_idx = 0;
+ data->overrun = 0;
data->trace_head = data->trace_tail = head_page(data);
data->trace_head_idx = 0;
data->trace_tail_idx = 0;
@@ -753,6 +754,7 @@ tracing_get_trace_entry(struct trace_arr
if (data->trace_head == data->trace_tail &&
idx_next == data->trace_tail_idx) {
/* overrun */
+ data->overrun++;
data->trace_tail_idx++;
if (data->trace_tail_idx >= ENTRIES_PER_PAGE) {
data->trace_tail =
@@ -2398,8 +2400,6 @@ tracing_read_pipe(struct file *filp, cha
{
struct trace_iterator *iter = filp->private_data;
struct trace_array_cpu *data;
- struct trace_array *tr = iter->tr;
- struct tracer *tracer = iter->trace;
static cpumask_t mask;
static int start;
unsigned long flags;
@@ -2478,10 +2478,11 @@ tracing_read_pipe(struct file *filp, cha
if (cnt >= PAGE_SIZE)
cnt = PAGE_SIZE - 1;
- memset(iter, 0, sizeof(*iter));
- iter->tr = tr;
- iter->trace = tracer;
+ /* reset all but tr, trace, and overruns */
iter->pos = -1;
+ memset(&iter->seq, 0,
+ sizeof(struct trace_iterator) -
+ offsetof(struct trace_iterator, seq));
/*
* We need to stop all tracing on all CPUS to read the
@@ -2510,6 +2511,11 @@ tracing_read_pipe(struct file *filp, cha
for_each_cpu_mask(cpu, mask) {
data = iter->tr->data[cpu];
__raw_spin_lock(&data->lock);
+
+ if (data->overrun > iter->last_overrun[cpu])
+ iter->overrun[cpu] +=
+ data->overrun - iter->last_overrun[cpu];
+ iter->last_overrun[cpu] = data->overrun;
}
while (find_next_entry_inc(iter) != NULL) {
Index: linux-sched-devel.git/kernel/trace/trace.h
===================================================================
--- linux-sched-devel.git.orig/kernel/trace/trace.h 2008-04-21 13:47:30.000000000 -0400
+++ linux-sched-devel.git/kernel/trace/trace.h 2008-04-21 14:38:09.000000000 -0400
@@ -102,6 +102,7 @@ struct trace_array_cpu {
void *trace_head; /* producer */
void *trace_tail; /* consumer */
unsigned long trace_idx;
+ unsigned long overrun;
unsigned long saved_latency;
unsigned long critical_start;
unsigned long critical_end;
@@ -162,10 +163,13 @@ struct trace_seq {
* results to users and which routines might sleep, etc:
*/
struct trace_iterator {
- struct trace_seq seq;
struct trace_array *tr;
struct tracer *trace;
+ long last_overrun[NR_CPUS];
+ long overrun[NR_CPUS];
+ /* The below is zeroed out in pipe_read */
+ struct trace_seq seq;
struct trace_entry *ent;
int cpu;
--
next prev parent reply other threads:[~2008-04-21 21:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 21:09 [PATCH 0/3] ftrace: overrun accounting and trace_pipe headers Steven Rostedt
2008-04-21 21:09 ` Steven Rostedt [this message]
2008-04-26 20:47 ` [PATCH 1/3] ftrace: add logic to record overruns Pekka Paalanen
2008-04-28 13:13 ` Steven Rostedt
2008-04-21 21:09 ` [PATCH 2/3] ftrace: add trace pipe header pluggin Steven Rostedt
2008-04-26 17:33 ` Pekka Paalanen
2008-04-28 13:05 ` Steven Rostedt
2008-04-21 21:09 ` [PATCH 3/3] TEST PATCH - ftrace example patch for use of trace pipe headers Steven Rostedt
2008-04-22 13:33 ` [PATCH 0/3] ftrace: overrun accounting and trace_pipe headers Ingo Molnar
2008-04-22 17:36 ` Pekka Paalanen
2008-04-23 0:58 ` Steven Rostedt
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=20080421212128.201844090@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--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