Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140826
b: refs/heads/master
c: c32e827
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt committed Feb 28, 2009
1 parent cb9c453 commit 286edf6
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 60 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: ef5580d0fffce6e0a01043bac0625128b5d409a7
refs/heads/master: c32e827b25054cb17b79cf97fb5e63ae4ce2223c
6 changes: 5 additions & 1 deletion trunk/kernel/trace/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#include <trace/trace_events.h>

#include "trace_events.h"
#include "trace_output.h"

#include "trace_events_stage_1.h"
#include "trace_events_stage_2.h"
#include "trace_events_stage_3.h"

#include <trace/trace_event_types.h>
19 changes: 19 additions & 0 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,4 +726,23 @@ static inline void trace_branch_disable(void)
}
#endif /* CONFIG_BRANCH_TRACER */

struct ftrace_event_call {
char *name;
char *system;
struct dentry *dir;
int enabled;
int (*regfunc)(void);
void (*unregfunc)(void);
int id;
struct dentry *raw_dir;
int raw_enabled;
int (*raw_init)(void);
int (*raw_reg)(void);
void (*raw_unreg)(void);
};

void event_trace_printk(unsigned long ip, const char *fmt, ...);
extern struct ftrace_event_call __start_ftrace_events[];
extern struct ftrace_event_call __stop_ftrace_events[];

#endif /* _LINUX_KERNEL_TRACE_H */
2 changes: 1 addition & 1 deletion trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <linux/module.h>
#include <linux/ctype.h>

#include "trace_events.h"
#include "trace.h"

#define TRACE_SYSTEM "TRACE_SYSTEM"

Expand Down
57 changes: 0 additions & 57 deletions trunk/kernel/trace/trace_events.h

This file was deleted.

34 changes: 34 additions & 0 deletions trunk/kernel/trace/trace_events_stage_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Stage 1 of the trace events.
*
* Override the macros in <trace/trace_event_types.h> to include the following:
*
* struct ftrace_raw_<call> {
* struct trace_entry ent;
* <type> <item>;
* [...]
* };
*
* The <type> <item> is created by the TRACE_FIELD(type, item, assign)
* macro. We simply do "type item;", and that will create the fields
* in the structure.
*/

#undef TRACE_FORMAT
#define TRACE_FORMAT(call, proto, args, fmt)

#undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(name, proto, args, fmt, tstruct, tpfmt) \
struct ftrace_raw_##name { \
struct trace_entry ent; \
tstruct \
}; \
static struct ftrace_event_call event_##name

#undef TRACE_STRUCT
#define TRACE_STRUCT(args...) args

#define TRACE_FIELD(type, item, assign) \
type item;

#include <trace/trace_event_types.h>
72 changes: 72 additions & 0 deletions trunk/kernel/trace/trace_events_stage_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Stage 2 of the trace events.
*
* Override the macros in <trace/trace_event_types.h> to include the following:
*
* enum print_line_t
* ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
* {
* struct trace_seq *s = &iter->seq;
* struct ftrace_raw_<call> *field; <-- defined in stage 1
* struct trace_entry *entry;
* int ret;
*
* entry = iter->ent;
*
* if (entry->type != event_<call>.id) {
* WARN_ON_ONCE(1);
* return TRACE_TYPE_UNHANDLED;
* }
*
* field = (typeof(field))entry;
*
* ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n");
* if (!ret)
* return TRACE_TYPE_PARTIAL_LINE;
*
* return TRACE_TYPE_HANDLED;
* }
*
* This is the method used to print the raw event to the trace
* output format. Note, this is not needed if the data is read
* in binary.
*/

#undef TRACE_STRUCT
#define TRACE_STRUCT(args...) args

#undef TRACE_FIELD
#define TRACE_FIELD(type, item, assign) \
field->item,


#undef TPRAWFMT
#define TPRAWFMT(args...) args

#undef TRACE_EVENT_FORMAT
#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
enum print_line_t \
ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
{ \
struct trace_seq *s = &iter->seq; \
struct ftrace_raw_##call *field; \
struct trace_entry *entry; \
int ret; \
\
entry = iter->ent; \
\
if (entry->type != event_##call.id) { \
WARN_ON_ONCE(1); \
return TRACE_TYPE_UNHANDLED; \
} \
\
field = (typeof(field))entry; \
\
ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n"); \
if (!ret) \
return TRACE_TYPE_PARTIAL_LINE; \
\
return TRACE_TYPE_HANDLED; \
}

#include <trace/trace_event_types.h>
Loading

0 comments on commit 286edf6

Please sign in to comment.