diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-07 07:47:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-07 07:47:45 -0400 |
commit | 93776a8ec746cf9d32c36e5a5b23d28d8be28826 (patch) | |
tree | 6c472ae9f709246ee5268e1d71559d07839fb965 /kernel/trace/trace_stat.c | |
parent | 34886c8bc590f078d4c0b88f50d061326639198d (diff) | |
parent | d508afb437daee7cf07da085b635c44a4ebf9b38 (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.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c index f8f48d84b2c3..fdde3a4a94cd 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) | |||
125 | INIT_LIST_HEAD(&new_entry->list); | 125 | INIT_LIST_HEAD(&new_entry->list); |
126 | new_entry->stat = stat; | 126 | new_entry->stat = stat; |
127 | 127 | ||
128 | list_for_each_entry(iter_entry, &session->stat_list, list) { | 128 | list_for_each_entry_reverse(iter_entry, &session->stat_list, |
129 | list) { | ||
129 | 130 | ||
130 | /* Insertion with a descendent sorting */ | 131 | /* Insertion with a descendent sorting */ |
131 | if (ts->stat_cmp(new_entry->stat, | 132 | if (ts->stat_cmp(iter_entry->stat, |
132 | iter_entry->stat) > 0) { | 133 | new_entry->stat) >= 0) { |
133 | 134 | ||
134 | list_add_tail(&new_entry->list, | ||
135 | &iter_entry->list); | ||
136 | break; | ||
137 | |||
138 | /* The current smaller value */ | ||
139 | } else if (list_is_last(&iter_entry->list, | ||
140 | &session->stat_list)) { | ||
141 | list_add(&new_entry->list, &iter_entry->list); | 135 | list_add(&new_entry->list, &iter_entry->list); |
142 | break; | 136 | break; |
143 | } | 137 | } |
144 | } | 138 | } |
139 | |||
140 | /* The current larger value */ | ||
141 | if (list_empty(&new_entry->list)) | ||
142 | list_add(&new_entry->list, &session->stat_list); | ||
145 | } | 143 | } |
146 | exit: | 144 | exit: |
147 | mutex_unlock(&session->stat_mutex); | 145 | mutex_unlock(&session->stat_mutex); |
@@ -163,7 +161,7 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos) | |||
163 | 161 | ||
164 | /* If we are in the beginning of the file, print the headers */ | 162 | /* If we are in the beginning of the file, print the headers */ |
165 | if (!*pos && session->ts->stat_headers) | 163 | if (!*pos && session->ts->stat_headers) |
166 | session->ts->stat_headers(s); | 164 | return SEQ_START_TOKEN; |
167 | 165 | ||
168 | return seq_list_start(&session->stat_list, *pos); | 166 | return seq_list_start(&session->stat_list, *pos); |
169 | } | 167 | } |
@@ -172,6 +170,9 @@ static void *stat_seq_next(struct seq_file *s, void *p, loff_t *pos) | |||
172 | { | 170 | { |
173 | struct tracer_stat_session *session = s->private; | 171 | struct tracer_stat_session *session = s->private; |
174 | 172 | ||
173 | if (p == SEQ_START_TOKEN) | ||
174 | return seq_list_start(&session->stat_list, *pos); | ||
175 | |||
175 | return seq_list_next(p, &session->stat_list, pos); | 176 | return seq_list_next(p, &session->stat_list, pos); |
176 | } | 177 | } |
177 | 178 | ||
@@ -186,6 +187,9 @@ static int stat_seq_show(struct seq_file *s, void *v) | |||
186 | struct tracer_stat_session *session = s->private; | 187 | struct tracer_stat_session *session = s->private; |
187 | struct trace_stat_list *l = list_entry(v, struct trace_stat_list, list); | 188 | struct trace_stat_list *l = list_entry(v, struct trace_stat_list, list); |
188 | 189 | ||
190 | if (v == SEQ_START_TOKEN) | ||
191 | return session->ts->stat_headers(s); | ||
192 | |||
189 | return session->ts->stat_show(s, l->stat); | 193 | return session->ts->stat_show(s, l->stat); |
190 | } | 194 | } |
191 | 195 | ||