diff options
author | Pekka Paalanen <pq@iki.fi> | 2008-05-12 15:21:02 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-24 05:27:08 -0400 |
commit | 2039238b79b51a50f8477f53f33750e1c3fc146a (patch) | |
tree | 4ce2cf80d840b1846c416e376e0e8391f8f3c0f6 /kernel/trace/trace_mmiotrace.c | |
parent | d0a7e8ca5b996d36219e6fc002907291c8ee677b (diff) |
mmiotrace: print overrun counts
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_mmiotrace.c')
-rw-r--r-- | kernel/trace/trace_mmiotrace.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index 6d2edbdde93..d0f649a2203 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -17,11 +17,13 @@ struct header_iter { | |||
17 | }; | 17 | }; |
18 | 18 | ||
19 | static struct trace_array *mmio_trace_array; | 19 | static struct trace_array *mmio_trace_array; |
20 | static bool overrun_detected; | ||
20 | 21 | ||
21 | static void mmio_reset_data(struct trace_array *tr) | 22 | static void mmio_reset_data(struct trace_array *tr) |
22 | { | 23 | { |
23 | int cpu; | 24 | int cpu; |
24 | 25 | ||
26 | overrun_detected = false; | ||
25 | tr->time_start = ftrace_now(tr->cpu); | 27 | tr->time_start = ftrace_now(tr->cpu); |
26 | 28 | ||
27 | for_each_online_cpu(cpu) | 29 | for_each_online_cpu(cpu) |
@@ -124,12 +126,34 @@ static void mmio_close(struct trace_iterator *iter) | |||
124 | iter->private = NULL; | 126 | iter->private = NULL; |
125 | } | 127 | } |
126 | 128 | ||
129 | static unsigned long count_overruns(struct trace_iterator *iter) | ||
130 | { | ||
131 | int cpu; | ||
132 | unsigned long cnt = 0; | ||
133 | for_each_online_cpu(cpu) { | ||
134 | cnt += iter->overrun[cpu]; | ||
135 | iter->overrun[cpu] = 0; | ||
136 | } | ||
137 | return cnt; | ||
138 | } | ||
139 | |||
127 | static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp, | 140 | static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp, |
128 | char __user *ubuf, size_t cnt, loff_t *ppos) | 141 | char __user *ubuf, size_t cnt, loff_t *ppos) |
129 | { | 142 | { |
130 | ssize_t ret; | 143 | ssize_t ret; |
131 | struct header_iter *hiter = iter->private; | 144 | struct header_iter *hiter = iter->private; |
132 | struct trace_seq *s = &iter->seq; | 145 | struct trace_seq *s = &iter->seq; |
146 | unsigned long n; | ||
147 | |||
148 | n = count_overruns(iter); | ||
149 | if (n) { | ||
150 | /* XXX: This is later than where events were lost. */ | ||
151 | trace_seq_printf(s, "MARK 0.000000 Lost %lu events.\n", n); | ||
152 | if (!overrun_detected) | ||
153 | pr_warning("mmiotrace has lost events.\n"); | ||
154 | overrun_detected = true; | ||
155 | goto print_out; | ||
156 | } | ||
133 | 157 | ||
134 | if (!hiter) | 158 | if (!hiter) |
135 | return 0; | 159 | return 0; |
@@ -142,6 +166,7 @@ static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp, | |||
142 | iter->private = NULL; | 166 | iter->private = NULL; |
143 | } | 167 | } |
144 | 168 | ||
169 | print_out: | ||
145 | ret = trace_seq_to_user(s, ubuf, cnt); | 170 | ret = trace_seq_to_user(s, ubuf, cnt); |
146 | return (ret == -EBUSY) ? 0 : ret; | 171 | return (ret == -EBUSY) ? 0 : ret; |
147 | } | 172 | } |