rpm.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM rpm
  4. #if !defined(_TRACE_RUNTIME_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_RUNTIME_POWER_H
  6. #include <linux/ktime.h>
  7. #include <linux/tracepoint.h>
  8. struct device;
  9. /*
  10. * The rpm_internal events are used for tracing some important
  11. * runtime pm internal functions.
  12. */
  13. DECLARE_EVENT_CLASS(rpm_internal,
  14. TP_PROTO(struct device *dev, int flags),
  15. TP_ARGS(dev, flags),
  16. TP_STRUCT__entry(
  17. __string( name, dev_name(dev) )
  18. __field( int, flags )
  19. __field( int , usage_count )
  20. __field( int , disable_depth )
  21. __field( int , runtime_auto )
  22. __field( int , request_pending )
  23. __field( int , irq_safe )
  24. __field( int , child_count )
  25. ),
  26. TP_fast_assign(
  27. __assign_str(name, dev_name(dev));
  28. __entry->flags = flags;
  29. __entry->usage_count = atomic_read(
  30. &dev->power.usage_count);
  31. __entry->disable_depth = dev->power.disable_depth;
  32. __entry->runtime_auto = dev->power.runtime_auto;
  33. __entry->request_pending = dev->power.request_pending;
  34. __entry->irq_safe = dev->power.irq_safe;
  35. __entry->child_count = atomic_read(
  36. &dev->power.child_count);
  37. ),
  38. TP_printk("%s flags-%x cnt-%-2d dep-%-2d auto-%-1d p-%-1d"
  39. " irq-%-1d child-%d",
  40. __get_str(name), __entry->flags,
  41. __entry->usage_count,
  42. __entry->disable_depth,
  43. __entry->runtime_auto,
  44. __entry->request_pending,
  45. __entry->irq_safe,
  46. __entry->child_count
  47. )
  48. );
  49. DEFINE_EVENT(rpm_internal, rpm_suspend,
  50. TP_PROTO(struct device *dev, int flags),
  51. TP_ARGS(dev, flags)
  52. );
  53. DEFINE_EVENT(rpm_internal, rpm_resume,
  54. TP_PROTO(struct device *dev, int flags),
  55. TP_ARGS(dev, flags)
  56. );
  57. DEFINE_EVENT(rpm_internal, rpm_idle,
  58. TP_PROTO(struct device *dev, int flags),
  59. TP_ARGS(dev, flags)
  60. );
  61. TRACE_EVENT(rpm_return_int,
  62. TP_PROTO(struct device *dev, unsigned long ip, int ret),
  63. TP_ARGS(dev, ip, ret),
  64. TP_STRUCT__entry(
  65. __string( name, dev_name(dev))
  66. __field( unsigned long, ip )
  67. __field( int, ret )
  68. ),
  69. TP_fast_assign(
  70. __assign_str(name, dev_name(dev));
  71. __entry->ip = ip;
  72. __entry->ret = ret;
  73. ),
  74. TP_printk("%pS:%s ret=%d", (void *)__entry->ip, __get_str(name),
  75. __entry->ret)
  76. );
  77. #endif /* _TRACE_RUNTIME_POWER_H */
  78. /* This part must be outside protection */
  79. #include <trace/define_trace.h>