Commit 97d53202 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

trace_stat: Fix missing entry in stat file

One entry is missing in the output of a stat file.

The cause is, when stat_seq_start() is called the 2nd time, we
should start from the (pos-1)th elem in the rbtree but not pos,
because pos == 0 is the header.
Signed-off-by: default avatarLi Zefan <>
Cc: Steven Rostedt <>
Cc: Frederic Weisbecker <>
LKML-Reference: <>
Signed-off-by: default avatarIngo Molnar <>
parent ba8b3a40
......@@ -203,17 +203,21 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)
struct stat_session *session = s->private;
struct rb_node *node;
int n = *pos;
int i;
/* Prevent from tracer switch or rbtree modification */
/* If we are in the beginning of the file, print the headers */
if (!*pos && session->ts->stat_headers)
if (session->ts->stat_headers) {
if (n == 0)
node = rb_first(&session->stat_root);
for (i = 0; node && i < *pos; i++)
for (i = 0; node && i < n; i++)
node = rb_next(node);
return node;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment