tracing: lost events changes
cover tracing: lost events changes
hi,
I noticed LOST EVENTS messages in the iterator "trace" file. According to the comment from commit bc21b478 this won't work.
<comment>
Note, it does not work with the iterator "trace" file, since it requires the use of consuming the page from the ring buffer to determine how many events were lost, which the iterator does not do.
</comment>
I'm not sure the attached fix (2/2) is on the right place, but stops the LOST EVENTS display for iterator "trace" file.
I also added option to control the LOST EVENTS display (1/2) if needed.
attached patches:
- 1/2 - adding lost-events option
- 2/2 - supress lost events message for iterator "trace"
wbr,
jirka
--- kernel/trace/trace.c | 24 ++++++++++++++---------- kernel/trace/trace.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-)
PATCH 1/2 tracing: adding lost-events option
hi,
adding option for control LOST EVENTS message output.
wbr,
jirka
--- kernel/trace/trace.c | 7 +++++-- kernel/trace/trace.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)
kernel/trace/trace.c +5 -2
@@ -332,7 +332,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);/* trace_flags holds trace_options default values */ unsigned long trace_flags =TRACE_ITER_PRINT_PARENT |TRACE_ITER_PRINTK |TRACE_ITER_ANNOTATE |TRACE_ITER_CONTEXT_INFO |TRACE_ITER_SLEEP_TIME | -TRACE_ITER_GRAPH_TIME ; +TRACE_ITER_GRAPH_TIME |TRACE_ITER_LOST_EVENTS ;static int trace_stop_count;static DEFINE_SPINLOCK (tracing_start_lock);
@@ -416,6 +416,7 @@ static const char *trace_options[] = {"latency-format" ,"sleep-time" ,"graph-time" , +"lost-events" , NULL };
@@ -2040,9 +2041,11 @@ static enum print_line_t print_trace_line(struct trace_iterator *iter) {enum print_line_t ret; -if (iter->lost_events) +if ((trace_flags &TRACE_ITER_LOST_EVENTS ) && + (iter->lost_events)) {trace_seq_printf (&iter->seq,"CPU:%d [LOST %lu EVENTS]\n" , iter->cpu, iter->lost_events); + }if (iter->trace && iter->trace->print_line) { ret = iter->trace->print_line (iter);
kernel/trace/trace.h +1 -0
@@ -606,6 +606,7 @@ enum trace_iterator_flags {TRACE_ITER_LATENCY_FMT =0x20000 ,TRACE_ITER_SLEEP_TIME =0x40000 ,TRACE_ITER_GRAPH_TIME =0x80000 , + TRACE_ITER_LOST_EVENTS = 0x100000, };/*
Signature · 1 line
1.6.6.1
PATCH 2/2 tracing: supress lost events message for iterator "trace"
In reply to Jiri Olsahi,
I noticed LOST EVENTS messages in the iterator "trace" file. According to the comment from commit bc21b478 this won't work.
<comment>
Note, it does not work with the iterator "trace" file, since it requires the use of consuming the page from the ring buffer to determine how many events were lost, which the iterator does not do.
</comment>
The change supress the LOST EVENTS message for iterator "trace".
wbr,
jirka
--- kernel/trace/trace.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
kernel/trace/trace.c +9 -8
@@ -1630,10 +1630,11 @@ struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, }/* Find the next real entry, and increment the iterator to the next entry */ -static void *find_next_entry_inc (struct trace_iterator *iter) +static void *find_next_entry_inc (struct trace_iterator *iter, +unsigned long *missing_events) { iter->ent =__find_next_entry (iter, &iter->cpu, - &iter->lost_events, &iter->ts); + missing_events, &iter->ts);if (iter->ent)trace_iterator_increment (iter);
@@ -1665,12 +1666,12 @@ static void *s_next(struct seq_file *m, void *v, loff_t *pos)return NULL ;if (iter->idx <0 ) - ent =find_next_entry_inc (iter); + ent =find_next_entry_inc (iter,NULL );else ent = iter;while (ent && iter->idx < i) - ent =find_next_entry_inc (iter); + ent =find_next_entry_inc (iter,NULL ); iter->pos = *pos;
@@ -3187,7 +3188,7 @@ waitagain:trace_event_read_lock ();trace_access_lock (iter->cpu_file); -while (find_next_entry_inc (iter) !=NULL ) { +while (find_next_entry_inc (iter, &iter->lost_events) !=NULL ) {enum print_line_t ret;int len = iter->seq.len;
@@ -3270,7 +3271,7 @@ tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)if (ret !=TRACE_TYPE_NO_CONSUME )trace_consume (iter); rem -= count; -if (!find_next_entry_inc (iter)) { +if (!find_next_entry_inc (iter, &iter->lost_events)) { rem =0 ; iter->ent =NULL ;break ;
@@ -3323,7 +3324,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,if (ret <=0 ) goto out_err; -if (!iter->ent && !find_next_entry_inc (iter)) { +if (!iter->ent && !find_next_entry_inc (iter, &iter->lost_events)) { ret = -EFAULT ; goto out_err; }
@@ -4460,7 +4461,7 @@ static void __ftrace_dump(bool disable_tracing) iter.iter_flags |=TRACE_FILE_LAT_FMT ; iter.pos =-1 ; -if (find_next_entry_inc (&iter) !=NULL ) { +if (find_next_entry_inc (&iter, &iter.lost_events) !=NULL ) {int ret; ret =print_trace_line (&iter);
Signature · 1 line
1.6.6.1
Steven Rostedt
maintainerQuoted 5 lines · Jiri Olsa
hi,
I noticed LOST EVENTS messages in the iterator "trace" file. According to the comment from commit
bc21b478this won't work.
Quoted 9 lines
<comment>
Note, it does not work with the iterator "trace" file, since it requires the use of consuming the page from the ring buffer to determine how many events were lost, which the iterator does not do.
</comment>I'm not sure the attached fix (2/2) is on the right place, but stops the LOST EVENTS display for iterator "trace" file.
This has already been fixed by Lai:
http://marc.info/?l=linux-kernel&m=127045871922996
And I asked Ingo to pull it here:
http://marc.info/?l=linux-kernel&m=127048065715829
Quoted 1 line
I also added option to control the LOST EVENTS display (1/2) if needed.
Hmm, I'm not sure we want to control it. It is very useful information.
Thanks,
-- Steve
Quoted 12 lines
attached patches:
- 1/2 - adding lost-events option
- 2/2 - supress lost events message for iterator "trace"wbr,
jirka--- kernel/trace/trace.c | 24 ++++++++++++++---------- kernel/trace/trace.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-)
Quoted 16 lines · Steven Rostedt
Quoted 5 lines · Jiri Olsa
hi,
I noticed LOST EVENTS messages in the iterator "trace" file. According to the comment from commit
bc21b478this won't work.Quoted 9 lines
<comment>
Note, it does not work with the iterator "trace" file, since it requires the use of consuming the page from the ring buffer to determine how many events were lost, which the iterator does not do.
</comment>I'm not sure the attached fix (2/2) is on the right place, but stops the LOST EVENTS display for iterator "trace" file.
Quoted 7 lines
This has already been fixed by Lai:
http://marc.info/?l=linux-kernel&m=127045871922996
And I asked Ingo to pull it here:
Yeah - i pulled it earlier today and pushed it out about two hours ago.
Ingo
Steven Rostedt
maintainerOn Wed, 2010-04-14 at 18:00 +0200, Ingo Molnar wrote:
\
Quoted 9 lines
Quoted 7 lines
This has already been fixed by Lai:
http://marc.info/?l=linux-kernel&m=127045871922996
And I asked Ingo to pull it here:
Yeah - i pulled it earlier today and pushed it out about two hours ago.
Thanks Ingo!
-- Steve