lock.h 1.66 KB
Newer Older
1
#undef TRACE_SYSTEM
2
#define TRACE_SYSTEM lock
3

4 5
#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_LOCK_H
6 7 8 9

#include <linux/lockdep.h>
#include <linux/tracepoint.h>

10 11
#ifdef CONFIG_LOCKDEP

12 13
TRACE_EVENT(lock_acquire,

14 15 16
	TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
		int trylock, int read, int check,
		struct lockdep_map *next_lock, unsigned long ip),
17

18 19
	TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),

20 21 22
	TP_STRUCT__entry(
		__field(unsigned int, flags)
		__string(name, lock->name)
23
		__field(void *, lockdep_addr)
24 25 26 27 28
	),

	TP_fast_assign(
		__entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
		__assign_str(name, lock->name);
29
		__entry->lockdep_addr = lock;
30 31
	),

32 33
	TP_printk("%p %s%s%s", __entry->lockdep_addr,
		  (__entry->flags & 1) ? "try " : "",
34 35 36 37
		  (__entry->flags & 2) ? "read " : "",
		  __get_str(name))
);

38
DECLARE_EVENT_CLASS(lock,
39

40
	TP_PROTO(struct lockdep_map *lock, unsigned long ip),
41

42
	TP_ARGS(lock, ip),
43 44

	TP_STRUCT__entry(
45 46
		__string(	name, 	lock->name	)
		__field(	void *, lockdep_addr	)
47 48 49 50
	),

	TP_fast_assign(
		__assign_str(name, lock->name);
51
		__entry->lockdep_addr = lock;
52 53
	),

54
	TP_printk("%p %s",  __entry->lockdep_addr, __get_str(name))
55
);
56

57
DEFINE_EVENT(lock, lock_release,
58

59
	TP_PROTO(struct lockdep_map *lock, unsigned long ip),
60

61 62
	TP_ARGS(lock, ip)
);
63

64
#ifdef CONFIG_LOCK_STAT
65

66
DEFINE_EVENT(lock, lock_contended,
67

68
	TP_PROTO(struct lockdep_map *lock, unsigned long ip),
69

70 71
	TP_ARGS(lock, ip)
);
72

73
DEFINE_EVENT(lock, lock_acquired,
74

75 76 77
	TP_PROTO(struct lockdep_map *lock, unsigned long ip),

	TP_ARGS(lock, ip)
78
);
79 80

#endif
81 82
#endif

83
#endif /* _TRACE_LOCK_H */
84 85 86

/* This part must be outside protection */
#include <trace/define_trace.h>