rpm.h 2.3 KB

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