Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269075
b: refs/heads/master
c: f81ab07
h: refs/heads/master
i:
  269073: 21ec2a7
  269071: 4d93091
v: v3
  • Loading branch information
Vaibhav Nagarnaik authored and Steven Rostedt committed Aug 30, 2011
1 parent c47dd7e commit 7a9d2ab
Show file tree
Hide file tree
Showing 2 changed files with 34 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: 86b6ef21b80ac6565d172cdab4384404de007eea
refs/heads/master: f81ab074c30234b07c8309c542cafd07bed721f7
33 changes: 33 additions & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,30 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
return cnt;
}

static ssize_t
tracing_total_entries_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
char buf[64];
int r, cpu;
unsigned long size = 0, expanded_size = 0;

mutex_lock(&trace_types_lock);
for_each_tracing_cpu(cpu) {
size += tr->entries >> 10;
if (!ring_buffer_expanded)
expanded_size += trace_buf_size >> 10;
}
if (ring_buffer_expanded)
r = sprintf(buf, "%lu\n", size);
else
r = sprintf(buf, "%lu (expanded: %lu)\n", size, expanded_size);
mutex_unlock(&trace_types_lock);

return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}

static ssize_t
tracing_free_buffer_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
Expand Down Expand Up @@ -3739,6 +3763,12 @@ static const struct file_operations tracing_entries_fops = {
.llseek = generic_file_llseek,
};

static const struct file_operations tracing_total_entries_fops = {
.open = tracing_open_generic,
.read = tracing_total_entries_read,
.llseek = generic_file_llseek,
};

static const struct file_operations tracing_free_buffer_fops = {
.write = tracing_free_buffer_write,
.release = tracing_free_buffer_release,
Expand Down Expand Up @@ -4450,6 +4480,9 @@ static __init int tracer_init_debugfs(void)
trace_create_file("buffer_size_kb", 0644, d_tracer,
&global_trace, &tracing_entries_fops);

trace_create_file("buffer_total_size_kb", 0444, d_tracer,
&global_trace, &tracing_total_entries_fops);

trace_create_file("free_buffer", 0644, d_tracer,
&global_trace, &tracing_free_buffer_fops);

Expand Down

0 comments on commit 7a9d2ab

Please sign in to comment.