2008-12-23 23:24:12 -05:00
|
|
|
#ifndef __TRACE_EVENTS_H
|
|
|
|
#define __TRACE_EVENTS_H
|
|
|
|
|
tracing: make trace_seq operations available for core kernel
In the process to make TRACE_EVENT macro work for modules, the trace_seq
operations must be available for core kernel code.
These operations are quite useful and can be used for other implementations.
The main idea is that we create a trace_seq handle that acts very much
like the seq_file handle.
struct trace_seq *s = kmalloc(sizeof(*s, GFP_KERNEL);
trace_seq_init(s);
trace_seq_printf(s, "some data %d\n", variable);
printk("%s", s->buffer);
The main use is to allow a top level function call several other functions
that may store printf like data into the buffer. Then at the end, the top
level function can process all the data with any method it would like to.
It could be passed to userspace, output via printk or even use seq_file:
trace_seq_to_user(s, ubuf, cnt);
seq_puts(m, s->buffer);
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2009-04-11 12:59:57 -04:00
|
|
|
#include <linux/trace_seq.h>
|
2008-12-23 23:24:12 -05:00
|
|
|
#include "trace.h"
|
|
|
|
|
2009-02-03 19:05:50 -05:00
|
|
|
typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
|
|
|
|
int flags);
|
2008-12-23 23:24:12 -05:00
|
|
|
|
|
|
|
struct trace_event {
|
|
|
|
struct hlist_node node;
|
|
|
|
int type;
|
|
|
|
trace_print_func trace;
|
|
|
|
trace_print_func raw;
|
|
|
|
trace_print_func hex;
|
|
|
|
trace_print_func binary;
|
|
|
|
};
|
|
|
|
|
2009-03-19 12:20:38 -04:00
|
|
|
extern enum print_line_t
|
|
|
|
trace_print_bprintk_msg_only(struct trace_iterator *iter);
|
|
|
|
extern enum print_line_t
|
|
|
|
trace_print_printk_msg_only(struct trace_iterator *iter);
|
|
|
|
|
2009-03-06 11:21:49 -05:00
|
|
|
extern int
|
2008-12-23 23:24:12 -05:00
|
|
|
seq_print_ip_sym(struct trace_seq *s, unsigned long ip,
|
|
|
|
unsigned long sym_flags);
|
2009-03-23 09:12:23 -04:00
|
|
|
extern int seq_print_userip_objs(const struct userstack_entry *entry,
|
|
|
|
struct trace_seq *s, unsigned long sym_flags);
|
|
|
|
extern int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm,
|
|
|
|
unsigned long ip, unsigned long sym_flags);
|
2008-12-23 23:24:12 -05:00
|
|
|
|
2009-03-23 09:12:23 -04:00
|
|
|
extern int trace_print_context(struct trace_iterator *iter);
|
|
|
|
extern int trace_print_lat_context(struct trace_iterator *iter);
|
2009-02-02 17:29:21 -05:00
|
|
|
|
2009-03-23 09:12:23 -04:00
|
|
|
extern struct trace_event *ftrace_find_event(int type);
|
|
|
|
extern int register_ftrace_event(struct trace_event *event);
|
|
|
|
extern int unregister_ftrace_event(struct trace_event *event);
|
2008-12-23 23:24:12 -05:00
|
|
|
|
2009-03-23 09:12:23 -04:00
|
|
|
extern enum print_line_t trace_nop_print(struct trace_iterator *iter,
|
|
|
|
int flags);
|
2008-12-23 23:24:13 -05:00
|
|
|
|
2008-12-23 23:24:12 -05:00
|
|
|
#define MAX_MEMHEX_BYTES 8
|
|
|
|
#define HEX_CHARS (MAX_MEMHEX_BYTES*2 + 1)
|
|
|
|
|
2008-12-23 23:24:13 -05:00
|
|
|
#define SEQ_PUT_FIELD_RET(s, x) \
|
|
|
|
do { \
|
|
|
|
if (!trace_seq_putmem(s, &(x), sizeof(x))) \
|
2009-01-15 05:05:40 -05:00
|
|
|
return TRACE_TYPE_PARTIAL_LINE; \
|
2008-12-23 23:24:13 -05:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define SEQ_PUT_HEX_FIELD_RET(s, x) \
|
|
|
|
do { \
|
|
|
|
BUILD_BUG_ON(sizeof(x) > MAX_MEMHEX_BYTES); \
|
|
|
|
if (!trace_seq_putmem_hex(s, &(x), sizeof(x))) \
|
2009-01-15 05:05:40 -05:00
|
|
|
return TRACE_TYPE_PARTIAL_LINE; \
|
2008-12-23 23:24:13 -05:00
|
|
|
} while (0)
|
|
|
|
|
2008-12-23 23:24:12 -05:00
|
|
|
#endif
|
|
|
|
|