[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A1B6A4C.3070407@cn.fujitsu.com>
Date: Tue, 26 May 2009 12:04:28 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Ingo Molnar <mingo@...e.hu>
CC: Jens Axboe <jens.axboe@...cle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Tom Zanussi <tzanussi@...il.com>,
"Theodore Ts'o" <tytso@....edu>,
Steven Whitehouse <swhiteho@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Jeff Moyer <jmoyer@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 1/2] tracing/events: make __string() more general
This changes __string(..., src) to __string(..., len), thus makes it more
general, and then block TRACE_EVENT() can use it.
Also introduce __fetch_str(), which is used in TP_assign() and returns
the address of the string, while __get_str() is used in TP_print().
[ Impact: TRACE_EVENT api change ]
Signed-off-by: Li Zefan <lizf@...fujitsu.com>
---
include/trace/events/irq.h | 12 ++++++------
include/trace/events/lockdep.h | 8 ++++----
include/trace/ftrace.h | 21 +++++++++++++--------
3 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 32a9f7e..ce2b939 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -25,8 +25,8 @@ TRACE_EVENT(irq_handler_entry,
TP_ARGS(irq, action),
TP_STRUCT__entry(
- __field( int, irq )
- __string( name, action->name )
+ __field( int, irq )
+ __string( name, strlen(action->name) )
),
TP_fast_assign(
@@ -86,8 +86,8 @@ TRACE_EVENT(softirq_entry,
TP_ARGS(h, vec),
TP_STRUCT__entry(
- __field( int, vec )
- __string( name, softirq_to_name[h-vec] )
+ __field( int, vec )
+ __string( name, strlen(softirq_to_name[h-vec]) )
),
TP_fast_assign(
@@ -116,8 +116,8 @@ TRACE_EVENT(softirq_exit,
TP_ARGS(h, vec),
TP_STRUCT__entry(
- __field( int, vec )
- __string( name, softirq_to_name[h-vec] )
+ __field( int, vec )
+ __string( name, strlen(softirq_to_name[h-vec]) )
),
TP_fast_assign(
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h
index 0e956c9..e6218fd 100644
--- a/include/trace/events/lockdep.h
+++ b/include/trace/events/lockdep.h
@@ -19,7 +19,7 @@ TRACE_EVENT(lock_acquire,
TP_STRUCT__entry(
__field(unsigned int, flags)
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -39,7 +39,7 @@ TRACE_EVENT(lock_release,
TP_ARGS(lock, nested, ip),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -58,7 +58,7 @@ TRACE_EVENT(lock_contended,
TP_ARGS(lock, ip),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
),
TP_fast_assign(
@@ -74,7 +74,7 @@ TRACE_EVENT(lock_acquired,
TP_ARGS(lock, ip, waittime),
TP_STRUCT__entry(
- __string(name, lock->name)
+ __string(name, strlen(lock->name))
__field(unsigned long, wait_usec)
__field(unsigned long, wait_nsec_rem)
),
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index b5ff2e8..430f7d2 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -25,7 +25,7 @@
#define __field(type, item) type item;
#undef __string
-#define __string(item, src) unsigned short __str_loc_##item;
+#define __string(item, len) unsigned short __str_loc_##item;
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
@@ -66,7 +66,7 @@
#define __field(type, item);
#undef __string
-#define __string(item, src) int item;
+#define __string(item, len) int item;
#undef TRACE_EVENT
#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
@@ -186,7 +186,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
return 0;
#undef __string
-#define __string(item, src) \
+#define __string(item, len) \
ret = trace_seq_printf(s, "\tfield: __str_loc " #item ";\t" \
"offset:%u;tsize:%u;\n", \
(unsigned int)offsetof(typeof(field), \
@@ -239,7 +239,7 @@ ftrace_format_##call(struct trace_seq *s) \
return ret;
#undef __string
-#define __string(item, src) \
+#define __string(item, len) \
ret = trace_define_field(event_call, "__str_loc", #item, \
offsetof(typeof(field), __str_loc_##item), \
sizeof(field.__str_loc_##item), 0);
@@ -411,10 +411,15 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *call) \
#define __array(type, item, len)
#undef __string
-#define __string(item, src) \
- __str_offsets.item = __str_size + \
- offsetof(typeof(*entry), __str_data); \
- __str_size += strlen(src) + 1;
+#define __string(item, len) \
+ __str_offsets.item = __str_size + \
+ offsetof(typeof(*entry), __str_data); \
+ __str_size += (len) + 1;
+
+#undef __fetch_str
+#define __fetch_str(dst) \
+ ({__entry->__str_loc_##dst = __str_offsets.dst; \
+ __get_str(dst);})
#undef __assign_str
#define __assign_str(dst, src) \
--
1.5.4.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists