lock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM lock
  3. #if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_LOCK_H
  5. #include <linux/lockdep.h>
  6. #include <linux/tracepoint.h>
  7. #ifdef CONFIG_LOCKDEP
  8. TRACE_EVENT(lock_acquire,
  9. TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
  10. int trylock, int read, int check,
  11. struct lockdep_map *next_lock, unsigned long ip),
  12. TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
  13. TP_STRUCT__entry(
  14. __field(unsigned int, flags)
  15. __string(name, lock->name)
  16. __field(void *, lockdep_addr)
  17. ),
  18. TP_fast_assign(
  19. __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
  20. __assign_str(name, lock->name);
  21. __entry->lockdep_addr = lock;
  22. ),
  23. TP_printk("%p %s%s%s", __entry->lockdep_addr,
  24. (__entry->flags & 1) ? "try " : "",
  25. (__entry->flags & 2) ? "read " : "",
  26. __get_str(name))
  27. );
  28. DECLARE_EVENT_CLASS(lock,
  29. TP_PROTO(struct lockdep_map *lock, unsigned long ip),
  30. TP_ARGS(lock, ip),
  31. TP_STRUCT__entry(
  32. __string( name, lock->name )
  33. __field( void *, lockdep_addr )
  34. ),
  35. TP_fast_assign(
  36. __assign_str(name, lock->name);
  37. __entry->lockdep_addr = lock;
  38. ),
  39. TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
  40. );
  41. DEFINE_EVENT(lock, lock_release,
  42. TP_PROTO(struct lockdep_map *lock, unsigned long ip),
  43. TP_ARGS(lock, ip)
  44. );
  45. #ifdef CONFIG_LOCK_STAT
  46. DEFINE_EVENT(lock, lock_contended,
  47. TP_PROTO(struct lockdep_map *lock, unsigned long ip),
  48. TP_ARGS(lock, ip)
  49. );
  50. DEFINE_EVENT(lock, lock_acquired,
  51. TP_PROTO(struct lockdep_map *lock, unsigned long ip),
  52. TP_ARGS(lock, ip)
  53. );
  54. #endif
  55. #endif
  56. #endif /* _TRACE_LOCK_H */
  57. /* This part must be outside protection */
  58. #include <trace/define_trace.h>