blob: 2821b86de63b9674d6ed3a68c7496f022b3cdff6 [file] [log] [blame]
Li Zefand0b6e042009-07-13 10:33:21 +08001#undef TRACE_SYSTEM
Frederic Weisbecker67178762009-11-13 10:06:34 +01002#define TRACE_SYSTEM lock
Li Zefand0b6e042009-07-13 10:33:21 +08003
Frederic Weisbecker67178762009-11-13 10:06:34 +01004#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_LOCK_H
Peter Zijlstraefed7922009-03-04 12:32:55 +01006
7#include <linux/lockdep.h>
8#include <linux/tracepoint.h>
9
Steven Rostedtea20d922009-04-10 08:54:16 -040010#ifdef CONFIG_LOCKDEP
11
Steven Rostedt39517092009-04-24 11:05:52 -040012TRACE_EVENT(lock_acquire,
13
Steven Rostedtea20d922009-04-10 08:54:16 -040014 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
15 int trylock, int read, int check,
16 struct lockdep_map *next_lock, unsigned long ip),
Steven Rostedtea20d922009-04-10 08:54:16 -040017
Steven Rostedt39517092009-04-24 11:05:52 -040018 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
19
20 TP_STRUCT__entry(
21 __field(unsigned int, flags)
22 __string(name, lock->name)
Hitoshi Mitakec965be12010-01-30 20:43:32 +090023 __field(void *, lockdep_addr)
Steven Rostedt39517092009-04-24 11:05:52 -040024 ),
25
26 TP_fast_assign(
27 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
28 __assign_str(name, lock->name);
Hitoshi Mitakec965be12010-01-30 20:43:32 +090029 __entry->lockdep_addr = lock;
Steven Rostedt39517092009-04-24 11:05:52 -040030 ),
31
Hitoshi Mitakec965be12010-01-30 20:43:32 +090032 TP_printk("%p %s%s%s", __entry->lockdep_addr,
33 (__entry->flags & 1) ? "try " : "",
Steven Rostedt39517092009-04-24 11:05:52 -040034 (__entry->flags & 2) ? "read " : "",
35 __get_str(name))
36);
37
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020038DECLARE_EVENT_CLASS(lock,
Steven Rostedt39517092009-04-24 11:05:52 -040039
Frederic Weisbecker93135432010-05-08 06:24:25 +020040 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
Steven Rostedt39517092009-04-24 11:05:52 -040041
Frederic Weisbecker93135432010-05-08 06:24:25 +020042 TP_ARGS(lock, ip),
Steven Rostedt39517092009-04-24 11:05:52 -040043
44 TP_STRUCT__entry(
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020045 __string( name, lock->name )
46 __field( void *, lockdep_addr )
Steven Rostedt39517092009-04-24 11:05:52 -040047 ),
48
49 TP_fast_assign(
50 __assign_str(name, lock->name);
Hitoshi Mitakec965be12010-01-30 20:43:32 +090051 __entry->lockdep_addr = lock;
Steven Rostedt39517092009-04-24 11:05:52 -040052 ),
53
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020054 TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
55);
56
57DEFINE_EVENT(lock, lock_release,
58
59 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
60
61 TP_ARGS(lock, ip)
Steven Rostedt39517092009-04-24 11:05:52 -040062);
Steven Rostedtea20d922009-04-10 08:54:16 -040063
64#ifdef CONFIG_LOCK_STAT
65
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020066DEFINE_EVENT(lock, lock_contended,
Steven Rostedt39517092009-04-24 11:05:52 -040067
Steven Rostedtea20d922009-04-10 08:54:16 -040068 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
Steven Rostedt39517092009-04-24 11:05:52 -040069
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020070 TP_ARGS(lock, ip)
Steven Rostedt39517092009-04-24 11:05:52 -040071);
Steven Rostedtea20d922009-04-10 08:54:16 -040072
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020073DEFINE_EVENT(lock, lock_acquired,
74
Frederic Weisbecker883a2a32010-05-08 06:16:11 +020075 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
Steven Rostedtea20d922009-04-10 08:54:16 -040076
Frederic Weisbecker2c193c72010-05-08 06:36:02 +020077 TP_ARGS(lock, ip)
Steven Rostedtea20d922009-04-10 08:54:16 -040078);
Peter Zijlstraefed7922009-03-04 12:32:55 +010079
80#endif
Steven Rostedtea20d922009-04-10 08:54:16 -040081#endif
82
Frederic Weisbecker67178762009-11-13 10:06:34 +010083#endif /* _TRACE_LOCK_H */
Steven Rostedta8d154b2009-04-10 09:36:00 -040084
85/* This part must be outside protection */
86#include <trace/define_trace.h>