Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146074
b: refs/heads/master
c: a118e4d
h: refs/heads/master
v: v3
  • Loading branch information
Tom Zanussi authored and Ingo Molnar committed Apr 29, 2009
1 parent 63a8631 commit 7db551d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 22 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: 30e673b230f9d556eb81ef68a7b1a08c8b3b142c
refs/heads/master: a118e4d1402f1349fe3d953493e4168a300a752d
7 changes: 4 additions & 3 deletions trunk/include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ extern int filter_current_check_discard(struct ftrace_event_call *call,
struct ring_buffer_event *event);

extern int trace_define_field(struct ftrace_event_call *call, char *type,
char *name, int offset, int size);
char *name, int offset, int size, int is_signed);

#define is_signed_type(type) (((type)(-1)) < 0)

/*
* The double __builtin_constant_p is because gcc will give us an error
Expand All @@ -144,10 +145,10 @@ do { \
__trace_printk(ip, fmt, ##args); \
} while (0)

#define __common_field(type, item) \
#define __common_field(type, item, is_signed) \
ret = trace_define_field(event_call, #type, "common_" #item, \
offsetof(typeof(field.ent), item), \
sizeof(field.ent.item)); \
sizeof(field.ent.item), is_signed); \
if (ret) \
return ret;

Expand Down
16 changes: 8 additions & 8 deletions trunk/include/trace/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ ftrace_format_##call(struct trace_seq *s) \
#define __field(type, item) \
ret = trace_define_field(event_call, #type, #item, \
offsetof(typeof(field), item), \
sizeof(field.item)); \
sizeof(field.item), is_signed_type(type)); \
if (ret) \
return ret;

Expand All @@ -234,15 +234,15 @@ ftrace_format_##call(struct trace_seq *s) \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
ret = trace_define_field(event_call, #type "[" #len "]", #item, \
offsetof(typeof(field), item), \
sizeof(field.item)); \
sizeof(field.item), 0); \
if (ret) \
return ret;

#undef __string
#define __string(item, src) \
ret = trace_define_field(event_call, "__str_loc", #item, \
offsetof(typeof(field), __str_loc_##item), \
sizeof(field.__str_loc_##item));
sizeof(field.__str_loc_##item), 0);

#undef TRACE_EVENT
#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
Expand All @@ -253,11 +253,11 @@ ftrace_define_fields_##call(void) \
struct ftrace_event_call *event_call = &event_##call; \
int ret; \
\
__common_field(int, type); \
__common_field(unsigned char, flags); \
__common_field(unsigned char, preempt_count); \
__common_field(int, pid); \
__common_field(int, tgid); \
__common_field(int, type, 1); \
__common_field(unsigned char, flags, 0); \
__common_field(unsigned char, preempt_count, 0); \
__common_field(int, pid, 1); \
__common_field(int, tgid, 1); \
\
tstruct; \
\
Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ struct ftrace_event_field {
char *type;
int offset;
int size;
int is_signed;
};

struct event_filter {
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/trace/trace_event_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,

TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
TRACE_STRUCT(
TRACE_FIELD(ktime_t, state_data.stamp, stamp)
TRACE_FIELD(ktime_t, state_data.end, end)
TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1)
TRACE_FIELD_SIGN(ktime_t, state_data.end, end, 1)
TRACE_FIELD(int, state_data.type, type)
TRACE_FIELD(int, state_data.state, state)
),
Expand Down
3 changes: 2 additions & 1 deletion trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static DEFINE_MUTEX(event_mutex);
LIST_HEAD(ftrace_events);

int trace_define_field(struct ftrace_event_call *call, char *type,
char *name, int offset, int size)
char *name, int offset, int size, int is_signed)
{
struct ftrace_event_field *field;

Expand All @@ -44,6 +44,7 @@ int trace_define_field(struct ftrace_event_call *call, char *type,

field->offset = offset;
field->size = size;
field->is_signed = is_signed;
list_add(&field->link, &call->fields);

return 0;
Expand Down
29 changes: 22 additions & 7 deletions trunk/kernel/trace/trace_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extern void __bad_type_size(void);
if (!ret) \
return 0;

#undef TRACE_FIELD_SIGN
#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
TRACE_FIELD(type, item, assign)

#undef TP_RAW_FMT
#define TP_RAW_FMT(args...) args
Expand Down Expand Up @@ -98,6 +101,10 @@ ftrace_format_##call(struct trace_seq *s) \
#define TRACE_FIELD(type, item, assign)\
entry->item = assign;

#undef TRACE_FIELD_SIGN
#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
TRACE_FIELD(type, item, assign)

#undef TP_CMD
#define TP_CMD(cmd...) cmd

Expand Down Expand Up @@ -149,15 +156,23 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
#define TRACE_FIELD(type, item, assign) \
ret = trace_define_field(event_call, #type, #item, \
offsetof(typeof(field), item), \
sizeof(field.item)); \
sizeof(field.item), is_signed_type(type)); \
if (ret) \
return ret;

#undef TRACE_FIELD_SPECIAL
#define TRACE_FIELD_SPECIAL(type, item, len, cmd) \
ret = trace_define_field(event_call, #type "[" #len "]", #item, \
offsetof(typeof(field), item), \
sizeof(field.item)); \
sizeof(field.item), 0); \
if (ret) \
return ret;

#undef TRACE_FIELD_SIGN
#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
ret = trace_define_field(event_call, #type, #item, \
offsetof(typeof(field), item), \
sizeof(field.item), is_signed); \
if (ret) \
return ret;

Expand All @@ -173,11 +188,11 @@ ftrace_define_fields_##call(void) \
struct args field; \
int ret; \
\
__common_field(unsigned char, type); \
__common_field(unsigned char, flags); \
__common_field(unsigned char, preempt_count); \
__common_field(int, pid); \
__common_field(int, tgid); \
__common_field(unsigned char, type, 0); \
__common_field(unsigned char, flags, 0); \
__common_field(unsigned char, preempt_count, 0); \
__common_field(int, pid, 1); \
__common_field(int, tgid, 1); \
\
tstruct; \
\
Expand Down

0 comments on commit 7db551d

Please sign in to comment.