aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_mmiotrace.c
diff options
context:
space:
mode:
authorPekka Paalanen <pq@iki.fi>2008-05-12 15:21:02 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-24 05:27:08 -0400
commit2039238b79b51a50f8477f53f33750e1c3fc146a (patch)
tree4ce2cf80d840b1846c416e376e0e8391f8f3c0f6 /kernel/trace/trace_mmiotrace.c
parentd0a7e8ca5b996d36219e6fc002907291c8ee677b (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.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index 6d2edbdde939..d0f649a2203d 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -17,11 +17,13 @@ struct header_iter {
17}; 17};
18 18
19static struct trace_array *mmio_trace_array; 19static struct trace_array *mmio_trace_array;
20static bool overrun_detected;
20 21
21static void mmio_reset_data(struct trace_array *tr) 22static 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
129static 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
127static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp, 140static 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
169print_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}