mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-04 13:34:39 +00:00
mmiotrace: print overrun counts
Signed-off-by: Pekka Paalanen <pq@iki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
d0a7e8ca5b
commit
2039238b79
1 changed files with 25 additions and 0 deletions
|
@ -17,11 +17,13 @@ struct header_iter {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct trace_array *mmio_trace_array;
|
static struct trace_array *mmio_trace_array;
|
||||||
|
static bool overrun_detected;
|
||||||
|
|
||||||
static void mmio_reset_data(struct trace_array *tr)
|
static void mmio_reset_data(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
|
overrun_detected = false;
|
||||||
tr->time_start = ftrace_now(tr->cpu);
|
tr->time_start = ftrace_now(tr->cpu);
|
||||||
|
|
||||||
for_each_online_cpu(cpu)
|
for_each_online_cpu(cpu)
|
||||||
|
@ -124,12 +126,34 @@ static void mmio_close(struct trace_iterator *iter)
|
||||||
iter->private = NULL;
|
iter->private = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long count_overruns(struct trace_iterator *iter)
|
||||||
|
{
|
||||||
|
int cpu;
|
||||||
|
unsigned long cnt = 0;
|
||||||
|
for_each_online_cpu(cpu) {
|
||||||
|
cnt += iter->overrun[cpu];
|
||||||
|
iter->overrun[cpu] = 0;
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
|
static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
|
||||||
char __user *ubuf, size_t cnt, loff_t *ppos)
|
char __user *ubuf, size_t cnt, loff_t *ppos)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
struct header_iter *hiter = iter->private;
|
struct header_iter *hiter = iter->private;
|
||||||
struct trace_seq *s = &iter->seq;
|
struct trace_seq *s = &iter->seq;
|
||||||
|
unsigned long n;
|
||||||
|
|
||||||
|
n = count_overruns(iter);
|
||||||
|
if (n) {
|
||||||
|
/* XXX: This is later than where events were lost. */
|
||||||
|
trace_seq_printf(s, "MARK 0.000000 Lost %lu events.\n", n);
|
||||||
|
if (!overrun_detected)
|
||||||
|
pr_warning("mmiotrace has lost events.\n");
|
||||||
|
overrun_detected = true;
|
||||||
|
goto print_out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hiter)
|
if (!hiter)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -142,6 +166,7 @@ static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp,
|
||||||
iter->private = NULL;
|
iter->private = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_out:
|
||||||
ret = trace_seq_to_user(s, ubuf, cnt);
|
ret = trace_seq_to_user(s, ubuf, cnt);
|
||||||
return (ret == -EBUSY) ? 0 : ret;
|
return (ret == -EBUSY) ? 0 : ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue