Lines Matching refs:tb

17 	struct trace_buffer *tb;  in trace_buffer_allocate()  local
19 if (size < sizeof(*tb)) { in trace_buffer_allocate()
24 tb = mmap(NULL, size, PROT_READ | PROT_WRITE, in trace_buffer_allocate()
26 if (tb == MAP_FAILED) { in trace_buffer_allocate()
31 tb->size = size; in trace_buffer_allocate()
32 tb->tail = tb->data; in trace_buffer_allocate()
33 tb->overflow = false; in trace_buffer_allocate()
35 return tb; in trace_buffer_allocate()
38 static bool trace_check_bounds(struct trace_buffer *tb, void *p) in trace_check_bounds() argument
40 return p < ((void *)tb + tb->size); in trace_check_bounds()
43 static bool trace_check_alloc(struct trace_buffer *tb, void *p) in trace_check_alloc() argument
51 if (tb->overflow) in trace_check_alloc()
54 if (!trace_check_bounds(tb, p)) { in trace_check_alloc()
55 tb->overflow = true; in trace_check_alloc()
62 static void *trace_alloc(struct trace_buffer *tb, int bytes) in trace_alloc() argument
66 p = tb->tail; in trace_alloc()
67 newtail = tb->tail + bytes; in trace_alloc()
68 if (!trace_check_alloc(tb, newtail)) in trace_alloc()
71 tb->tail = newtail; in trace_alloc()
76 static struct trace_entry *trace_alloc_entry(struct trace_buffer *tb, int payload_size) in trace_alloc_entry() argument
80 e = trace_alloc(tb, sizeof(*e) + payload_size); in trace_alloc_entry()
87 int trace_log_reg(struct trace_buffer *tb, u64 reg, u64 value) in trace_log_reg() argument
92 e = trace_alloc_entry(tb, sizeof(reg) + sizeof(value)); in trace_log_reg()
104 int trace_log_counter(struct trace_buffer *tb, u64 value) in trace_log_counter() argument
109 e = trace_alloc_entry(tb, sizeof(value)); in trace_log_counter()
120 int trace_log_string(struct trace_buffer *tb, char *str) in trace_log_string() argument
129 e = trace_alloc_entry(tb, len + 1); in trace_log_string()
142 int trace_log_indent(struct trace_buffer *tb) in trace_log_indent() argument
146 e = trace_alloc_entry(tb, 0); in trace_log_indent()
155 int trace_log_outdent(struct trace_buffer *tb) in trace_log_outdent() argument
159 e = trace_alloc_entry(tb, 0); in trace_log_outdent()
269 void trace_buffer_print(struct trace_buffer *tb) in trace_buffer_print() argument
276 printf(" address %p \n", tb); in trace_buffer_print()
277 printf(" tail %p\n", tb->tail); in trace_buffer_print()
278 printf(" size %llu\n", tb->size); in trace_buffer_print()
279 printf(" overflow %s\n", tb->overflow ? "TRUE" : "false"); in trace_buffer_print()
282 p = tb->data; in trace_buffer_print()
287 while (trace_check_bounds(tb, p) && p < tb->tail) { in trace_buffer_print()
297 void trace_print_location(struct trace_buffer *tb) in trace_print_location() argument
299 printf("Trace buffer 0x%llx bytes @ %p\n", tb->size, tb); in trace_print_location()