Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121113
b: refs/heads/master
c: 1696b2b
h: refs/heads/master
i:
  121111: 6fe7992
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Nov 13, 2008
1 parent a076fab commit 17d51ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a94c80e78bc9f4493ffc25a02d5d7bcd93c399d0
refs/heads/master: 1696b2b0f44a8d42f3e6b1ea90c21790871c04d9
22 changes: 5 additions & 17 deletions trunk/Documentation/ftrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ of ftrace. Here is a list of some of the key files:
only be recorded if the latency is greater than
the value in this file. (in microseconds)

buffer_size_kb: This sets or displays the number of bytes each CPU
buffer_size_kb: This sets or displays the number of kilobytes each CPU
buffer can hold. The tracer buffers are the same size
for each CPU. The displayed number is the size of the
CPU buffer and not total size of all buffers. The
CPU buffer and not total size of all buffers. The
trace buffers are allocated in pages (blocks of memory
that the kernel uses for allocation, usually 4 KB in size).
If the last page allocated has room for more bytes
Expand Down Expand Up @@ -1306,28 +1306,16 @@ the full size, multiply the number of possible CPUS with the
number of entries.

# cat /debug/tracing/buffer_size_kb
65620
1408 (units kilobytes)

Note, to modify this, you must have tracing completely disabled. To do that,
echo "nop" into the current_tracer. If the current_tracer is not set
to "nop", an EINVAL error will be returned.

# echo nop > /debug/tracing/current_tracer
# echo 100000 > /debug/tracing/buffer_size_kb
# echo 10000 > /debug/tracing/buffer_size_kb
# cat /debug/tracing/buffer_size_kb
100045


Notice that we echoed in 100,000 but the size is 100,045. The entries
are held in individual pages. It allocates the number of pages it takes
to fulfill the request. If more entries may fit on the last page
then they will be added.

# echo 1 > /debug/tracing/buffer_size_kb
# cat /debug/tracing/buffer_size_kb
85

This shows us that 85 entries can fit in a single page.
10000 (units kilobytes)

The number of pages which will be allocated is limited to a percentage
of available memory. Allocating too much will produce an error.
Expand Down
5 changes: 4 additions & 1 deletion trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2905,7 +2905,7 @@ tracing_entries_read(struct file *filp, char __user *ubuf,
char buf[64];
int r;

r = sprintf(buf, "%lu\n", tr->entries);
r = sprintf(buf, "%lu\n", tr->entries >> 10);
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}

Expand Down Expand Up @@ -2945,6 +2945,9 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
atomic_inc(&max_tr.data[cpu]->disabled);
}

/* value is in KB */
val <<= 10;

if (val != global_trace.entries) {
ret = ring_buffer_resize(global_trace.buffer, val);
if (ret < 0) {
Expand Down

0 comments on commit 17d51ce

Please sign in to comment.