aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace_stat.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-07 13:47:33 +0200
committerIngo Molnar <mingo@elte.hu>2009-04-07 13:47:45 +0200
commit93776a8ec746cf9d32c36e5a5b23d28d8be28826 (patch)
tree6c472ae9f709246ee5268e1d71559d07839fb965 /kernel/trace/trace_stat.c
parent34886c8bc590f078d4c0b88f50d061326639198d (diff)
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
Merge branch 'linus' into tracing/core
Merge reason: update to upstream tracing facilities Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_stat.c')
-rw-r--r--kernel/trace/trace_stat.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index f8f48d84b2c..fdde3a4a94c 100644
--- a/kernel/trace/trace_stat.c
+++ b/kernel/trace/trace_stat.c
@@ -125,23 +125,21 @@ static int stat_seq_init(struct tracer_stat_session *session)
INIT_LIST_HEAD(&new_entry->list);
new_entry->stat = stat;
- list_for_each_entry(iter_entry, &session->stat_list, list) {
+ list_for_each_entry_reverse(iter_entry, &session->stat_list,
+ list) {
/* Insertion with a descendent sorting */
- if (ts->stat_cmp(new_entry->stat,
- iter_entry->stat) > 0) {
+ if (ts->stat_cmp(iter_entry->stat,
+ new_entry->stat) >= 0) {
- list_add_tail(&new_entry->list,
- &iter_entry->list);
- break;
-
- /* The current smaller value */
- } else if (list_is_last(&iter_entry->list,
- &session->stat_list)) {
list_add(&new_entry->list, &iter_entry->list);
break;
}
}
+
+ /* The current larger value */
+ if (list_empty(&new_entry->list))
+ list_add(&new_entry->list, &session->stat_list);
}
exit:
mutex_unlock(&session->stat_mutex);
@@ -163,7 +161,7 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)
/* If we are in the beginning of the file, print the headers */
if (!*pos && session->ts->stat_headers)
- session->ts->stat_headers(s);
+ return SEQ_START_TOKEN;
return seq_list_start(&session->stat_list, *pos);
}
@@ -172,6 +170,9 @@ static void *stat_seq_next(struct seq_file *s, void *p, loff_t *pos)
{
struct tracer_stat_session *session = s->private;
+ if (p == SEQ_START_TOKEN)
+ return seq_list_start(&session->stat_list, *pos);
+
return seq_list_next(p, &session->stat_list, pos);
}
@@ -186,6 +187,9 @@ static int stat_seq_show(struct seq_file *s, void *v)
struct tracer_stat_session *session = s->private;
struct trace_stat_list *l = list_entry(v, struct trace_stat_list, list);
+ if (v == SEQ_START_TOKEN)
+ return session->ts->stat_headers(s);
+
return session->ts->stat_show(s, l->stat);
}