diff options
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r-- | kernel/trace/ring_buffer.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index f935bd5ec3e8..84a6055f37c9 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -22,6 +22,28 @@ | |||
22 | #include "trace.h" | 22 | #include "trace.h" |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * The ring buffer header is special. We must manually up keep it. | ||
26 | */ | ||
27 | int ring_buffer_print_entry_header(struct trace_seq *s) | ||
28 | { | ||
29 | int ret; | ||
30 | |||
31 | ret = trace_seq_printf(s, "\ttype : 2 bits\n"); | ||
32 | ret = trace_seq_printf(s, "\tlen : 3 bits\n"); | ||
33 | ret = trace_seq_printf(s, "\ttime_delta : 27 bits\n"); | ||
34 | ret = trace_seq_printf(s, "\tarray : 32 bits\n"); | ||
35 | ret = trace_seq_printf(s, "\n"); | ||
36 | ret = trace_seq_printf(s, "\tpadding : type == %d\n", | ||
37 | RINGBUF_TYPE_PADDING); | ||
38 | ret = trace_seq_printf(s, "\ttime_extend : type == %d\n", | ||
39 | RINGBUF_TYPE_TIME_EXTEND); | ||
40 | ret = trace_seq_printf(s, "\tdata : type == %d\n", | ||
41 | RINGBUF_TYPE_DATA); | ||
42 | |||
43 | return ret; | ||
44 | } | ||
45 | |||
46 | /* | ||
25 | * The ring buffer is made up of a list of pages. A separate list of pages is | 47 | * The ring buffer is made up of a list of pages. A separate list of pages is |
26 | * allocated for each CPU. A writer may only write to a buffer that is | 48 | * allocated for each CPU. A writer may only write to a buffer that is |
27 | * associated with the CPU it is currently executing on. A reader may read | 49 | * associated with the CPU it is currently executing on. A reader may read |
@@ -340,6 +362,28 @@ static inline int test_time_stamp(u64 delta) | |||
340 | 362 | ||
341 | #define BUF_PAGE_SIZE (PAGE_SIZE - BUF_PAGE_HDR_SIZE) | 363 | #define BUF_PAGE_SIZE (PAGE_SIZE - BUF_PAGE_HDR_SIZE) |
342 | 364 | ||
365 | int ring_buffer_print_page_header(struct trace_seq *s) | ||
366 | { | ||
367 | struct buffer_data_page field; | ||
368 | int ret; | ||
369 | |||
370 | ret = trace_seq_printf(s, "\tfield: u64 timestamp;\t" | ||
371 | "offset:0;\tsize:%u;\n", | ||
372 | (unsigned int)sizeof(field.time_stamp)); | ||
373 | |||
374 | ret = trace_seq_printf(s, "\tfield: local_t commit;\t" | ||
375 | "offset:%u;\tsize:%u;\n", | ||
376 | (unsigned int)offsetof(typeof(field), commit), | ||
377 | (unsigned int)sizeof(field.commit)); | ||
378 | |||
379 | ret = trace_seq_printf(s, "\tfield: char data;\t" | ||
380 | "offset:%u;\tsize:%u;\n", | ||
381 | (unsigned int)offsetof(typeof(field), data), | ||
382 | (unsigned int)BUF_PAGE_SIZE); | ||
383 | |||
384 | return ret; | ||
385 | } | ||
386 | |||
343 | /* | 387 | /* |
344 | * head_page == tail_page && head == tail then buffer is empty. | 388 | * head_page == tail_page && head == tail then buffer is empty. |
345 | */ | 389 | */ |