workqueue.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM workqueue
  3. #if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_WORKQUEUE_H
  5. #include <linux/tracepoint.h>
  6. #include <linux/workqueue.h>
  7. DECLARE_EVENT_CLASS(workqueue_work,
  8. TP_PROTO(struct work_struct *work),
  9. TP_ARGS(work),
  10. TP_STRUCT__entry(
  11. __field( void *, work )
  12. ),
  13. TP_fast_assign(
  14. __entry->work = work;
  15. ),
  16. TP_printk("work struct %p", __entry->work)
  17. );
  18. /**
  19. * workqueue_queue_work - called when a work gets queued
  20. * @req_cpu: the requested cpu
  21. * @pwq: pointer to struct pool_workqueue
  22. * @work: pointer to struct work_struct
  23. *
  24. * This event occurs when a work is queued immediately or once a
  25. * delayed work is actually queued on a workqueue (ie: once the delay
  26. * has been reached).
  27. */
  28. TRACE_EVENT(workqueue_queue_work,
  29. TP_PROTO(unsigned int req_cpu, struct pool_workqueue *pwq,
  30. struct work_struct *work),
  31. TP_ARGS(req_cpu, pwq, work),
  32. TP_STRUCT__entry(
  33. __field( void *, work )
  34. __field( void *, function)
  35. __field( void *, workqueue)
  36. __field( unsigned int, req_cpu )
  37. __field( unsigned int, cpu )
  38. ),
  39. TP_fast_assign(
  40. __entry->work = work;
  41. __entry->function = work->func;
  42. __entry->workqueue = pwq->wq;
  43. __entry->req_cpu = req_cpu;
  44. __entry->cpu = pwq->pool->cpu;
  45. ),
  46. TP_printk("work struct=%p function=%pf workqueue=%p req_cpu=%u cpu=%u",
  47. __entry->work, __entry->function, __entry->workqueue,
  48. __entry->req_cpu, __entry->cpu)
  49. );
  50. /**
  51. * workqueue_activate_work - called when a work gets activated
  52. * @work: pointer to struct work_struct
  53. *
  54. * This event occurs when a queued work is put on the active queue,
  55. * which happens immediately after queueing unless @max_active limit
  56. * is reached.
  57. */
  58. DEFINE_EVENT(workqueue_work, workqueue_activate_work,
  59. TP_PROTO(struct work_struct *work),
  60. TP_ARGS(work)
  61. );
  62. /**
  63. * workqueue_execute_start - called immediately before the workqueue callback
  64. * @work: pointer to struct work_struct
  65. *
  66. * Allows to track workqueue execution.
  67. */
  68. TRACE_EVENT(workqueue_execute_start,
  69. TP_PROTO(struct work_struct *work),
  70. TP_ARGS(work),
  71. TP_STRUCT__entry(
  72. __field( void *, work )
  73. __field( void *, function)
  74. ),
  75. TP_fast_assign(
  76. __entry->work = work;
  77. __entry->function = work->func;
  78. ),
  79. TP_printk("work struct %p: function %pf", __entry->work, __entry->function)
  80. );
  81. /**
  82. * workqueue_execute_end - called immediately after the workqueue callback
  83. * @work: pointer to struct work_struct
  84. *
  85. * Allows to track workqueue execution.
  86. */
  87. DEFINE_EVENT(workqueue_work, workqueue_execute_end,
  88. TP_PROTO(struct work_struct *work),
  89. TP_ARGS(work)
  90. );
  91. #endif /* _TRACE_WORKQUEUE_H */
  92. /* This part must be outside protection */
  93. #include <trace/define_trace.h>