[PATCH 10/11] tracing/events: modify lockdep print to new format

Steven Rostedt
2009-06-10T17:02:51Z

[-- Attachment #1: 0010-tracing-events-modify-lockdep-print-to-new-format.patch --]
[-- Type: text/plain, Size: 2065 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Use new format for better parsing of lockdep events.

The current conversion of the nsec value in the lockstat lock event
is performed in the fast path. Now that there is a tag to do the conversion
we can move this into the slow path and increase performance while tracing.

[ Impact: increase performance in lockstat tracing ]

Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/events/lockdep.h | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h
index 0e956c9..4251f17 100644
--- a/include/trace/events/lockdep.h
+++ b/include/trace/events/lockdep.h
@@ -27,9 +27,8 @@ TRACE_EVENT(lock_acquire,
__assign_str(name, lock->name);
),

- TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "",
- (__entry->flags & 2) ? "read " : "",
- __get_str(name))
+ TP_FORMAT("<ifmask:flags:1:try :><ifmask:flags:2:read :>"
+ "<string:name>")
);

TRACE_EVENT(lock_release,
@@ -46,7 +45,7 @@ TRACE_EVENT(lock_release,
__assign_str(name, lock->name);
),

- TP_printk("%s", __get_str(name))
+ TP_FORMAT("<string:name>")
);

#ifdef CONFIG_LOCK_STAT
@@ -65,7 +64,7 @@ TRACE_EVENT(lock_contended,
__assign_str(name, lock->name);
),

- TP_printk("%s", __get_str(name))
+ TP_FORMAT("<string:name>")
);

TRACE_EVENT(lock_acquired,
@@ -75,16 +74,13 @@ TRACE_EVENT(lock_acquired,

TP_STRUCT__entry(
__string(name, lock->name)
- __field(unsigned long, wait_usec)
- __field(unsigned long, wait_nsec_rem)
+ __field(long long, wait_nsec)
),
TP_fast_assign(
__assign_str(name, lock->name);
- __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
- __entry->wait_usec = (unsigned long) waittime;
+ __entry->wait_nsec = waittime;
),
- TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec,
- __entry->wait_nsec_rem)
+ TP_FORMAT("<string:name> (<nsec2usec:3:wait_nsec> us)")
);

#endif
--
1.6.3.1

--