Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146082
b: refs/heads/master
c: c8d7718
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 5, 2009
1 parent 852c566 commit 42935da
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f0d2c681ac0a85142fc8abe65fc33fcad35cb9b7
refs/heads/master: c8d771835e18c938dae8690611d65fe98ad30f58
42 changes: 42 additions & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3595,6 +3595,45 @@ static const struct file_operations tracing_buffers_fops = {
.llseek = no_llseek,
};

static ssize_t
tracing_stats_read(struct file *filp, char __user *ubuf,
size_t count, loff_t *ppos)
{
unsigned long cpu = (unsigned long)filp->private_data;
struct trace_array *tr = &global_trace;
struct trace_seq *s;
unsigned long cnt;

s = kmalloc(sizeof(*s), GFP_ATOMIC);
if (!s)
return ENOMEM;

trace_seq_init(s);

cnt = ring_buffer_entries_cpu(tr->buffer, cpu);
trace_seq_printf(s, "entries: %ld\n", cnt);

cnt = ring_buffer_overrun_cpu(tr->buffer, cpu);
trace_seq_printf(s, "overrun: %ld\n", cnt);

cnt = ring_buffer_commit_overrun_cpu(tr->buffer, cpu);
trace_seq_printf(s, "commit overrun: %ld\n", cnt);

cnt = ring_buffer_nmi_dropped_cpu(tr->buffer, cpu);
trace_seq_printf(s, "nmi dropped: %ld\n", cnt);

count = simple_read_from_buffer(ubuf, count, ppos, s->buffer, s->len);

kfree(s);

return count;
}

static const struct file_operations tracing_stats_fops = {
.open = tracing_open_generic,
.read = tracing_stats_read,
};

#ifdef CONFIG_DYNAMIC_FTRACE

int __weak ftrace_arch_read_dyn_info(char *buf, int size)
Expand Down Expand Up @@ -3708,6 +3747,9 @@ static void tracing_init_debugfs_percpu(long cpu)

trace_create_file("trace_pipe_raw", 0444, d_cpu,
(void *) cpu, &tracing_buffers_fops);

trace_create_file("stats", 0444, d_cpu,
(void *) cpu, &tracing_stats_fops);
}

#ifdef CONFIG_FTRACE_SELFTEST
Expand Down

0 comments on commit 42935da

Please sign in to comment.