aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/ftrace.h
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-07-15 22:54:02 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-07-20 11:38:44 -0400
commit7d536cb3fb9993bdcd5a2fbaa6b0670ded4e101c (patch)
tree63c4a6ec6de75d9a2db7d677c768a5f2953fa237 /include/trace/ftrace.h
parent68fd60a8c8bca6af51805c45f286f0f2572ac977 (diff)
tracing/events: record the size of dynamic arrays
When a dynamic array is defined, we add __data_loc_foo in trace_entry to record the offset of the array, but the size of the array is not recorded, which causes 2 problems: - the event filter just compares the first 2 chars of the strings. - parsers can't parse dynamic arrays. So we encode the size of each dynamic array in the higher 16 bits of __data_loc_foo, while the offset is in lower 16 bits. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4A5E964A.9000403@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r--include/trace/ftrace.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index cc78943e0038..3cbb96ef34f4 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -25,7 +25,7 @@
25#define __array(type, item, len) type item[len]; 25#define __array(type, item, len) type item[len];
26 26
27#undef __dynamic_array 27#undef __dynamic_array
28#define __dynamic_array(type, item, len) unsigned short __data_loc_##item; 28#define __dynamic_array(type, item, len) u32 __data_loc_##item;
29 29
30#undef __string 30#undef __string
31#define __string(item, src) __dynamic_array(char, item, -1) 31#define __string(item, src) __dynamic_array(char, item, -1)
@@ -51,13 +51,14 @@
51 * Include the following: 51 * Include the following:
52 * 52 *
53 * struct ftrace_data_offsets_<call> { 53 * struct ftrace_data_offsets_<call> {
54 * int <item1>; 54 * u32 <item1>;
55 * int <item2>; 55 * u32 <item2>;
56 * [...] 56 * [...]
57 * }; 57 * };
58 * 58 *
59 * The __dynamic_array() macro will create each int <item>, this is 59 * The __dynamic_array() macro will create each u32 <item>, this is
60 * to keep the offset of each array from the beginning of the event. 60 * to keep the offset of each array from the beginning of the event.
61 * The size of an array is also encoded, in the higher 16 bits of <item>.
61 */ 62 */
62 63
63#undef __field 64#undef __field
@@ -67,7 +68,7 @@
67#define __array(type, item, len) 68#define __array(type, item, len)
68 69
69#undef __dynamic_array 70#undef __dynamic_array
70#define __dynamic_array(type, item, len) int item; 71#define __dynamic_array(type, item, len) u32 item;
71 72
72#undef __string 73#undef __string
73#define __string(item, src) __dynamic_array(char, item, -1) 74#define __string(item, src) __dynamic_array(char, item, -1)
@@ -207,7 +208,7 @@ ftrace_format_##call(struct trace_seq *s) \
207 208
208#undef __get_dynamic_array 209#undef __get_dynamic_array
209#define __get_dynamic_array(field) \ 210#define __get_dynamic_array(field) \
210 ((void *)__entry + __entry->__data_loc_##field) 211 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
211 212
212#undef __get_str 213#undef __get_str
213#define __get_str(field) (char *)__get_dynamic_array(field) 214#define __get_str(field) (char *)__get_dynamic_array(field)
@@ -325,6 +326,7 @@ ftrace_define_fields_##call(void) \
325#define __dynamic_array(type, item, len) \ 326#define __dynamic_array(type, item, len) \
326 __data_offsets->item = __data_size + \ 327 __data_offsets->item = __data_size + \
327 offsetof(typeof(*entry), __data); \ 328 offsetof(typeof(*entry), __data); \
329 __data_offsets->item |= (len * sizeof(type)) << 16; \
328 __data_size += (len) * sizeof(type); 330 __data_size += (len) * sizeof(type);
329 331
330#undef __string 332#undef __string