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(-)
--
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>
The change supress the LOST EVENTS message for iterator "trace".
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index bf00438..536e573 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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 ...hi,
adding option for control LOST EVENTS message output.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace.c | 7 +++++--
kernel/trace/trace.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 60f3b62..bf00438 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index bec2c97..4607b43 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -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,
};
/*
--
1.6.6.1
--
This has already been fixed by Lai: http://marc.info/?l=linux-kernel&m=127045871922996 And I asked Ingo to pull it here: Hmm, I'm not sure we want to control it. It is very useful information. Thanks, --
Yeah - i pulled it earlier today and pushed it out about two hours ago. Ingo --
On Wed, 2010-04-14 at 18:00 +0200, Ingo Molnar wrote: Thanks Ingo! -- Steve --
