pcm_param_trace.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM snd_pcm
  3. #if !defined(_PCM_PARAMS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _PCM_PARAMS_TRACE_H
  5. #include <linux/tracepoint.h>
  6. #define HW_PARAM_ENTRY(param) {SNDRV_PCM_HW_PARAM_##param, #param}
  7. #define hw_param_labels \
  8. HW_PARAM_ENTRY(ACCESS), \
  9. HW_PARAM_ENTRY(FORMAT), \
  10. HW_PARAM_ENTRY(SUBFORMAT), \
  11. HW_PARAM_ENTRY(SAMPLE_BITS), \
  12. HW_PARAM_ENTRY(FRAME_BITS), \
  13. HW_PARAM_ENTRY(CHANNELS), \
  14. HW_PARAM_ENTRY(RATE), \
  15. HW_PARAM_ENTRY(PERIOD_TIME), \
  16. HW_PARAM_ENTRY(PERIOD_SIZE), \
  17. HW_PARAM_ENTRY(PERIOD_BYTES), \
  18. HW_PARAM_ENTRY(PERIODS), \
  19. HW_PARAM_ENTRY(BUFFER_TIME), \
  20. HW_PARAM_ENTRY(BUFFER_SIZE), \
  21. HW_PARAM_ENTRY(BUFFER_BYTES), \
  22. HW_PARAM_ENTRY(TICK_TIME)
  23. TRACE_EVENT(hw_mask_param,
  24. TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_hw_param_t type, int index, const struct snd_mask *prev, const struct snd_mask *curr),
  25. TP_ARGS(substream, type, index, prev, curr),
  26. TP_STRUCT__entry(
  27. __field(int, card)
  28. __field(int, device)
  29. __field(int, subdevice)
  30. __field(int, direction)
  31. __field(snd_pcm_hw_param_t, type)
  32. __field(int, index)
  33. __field(int, total)
  34. __array(__u32, prev_bits, 8)
  35. __array(__u32, curr_bits, 8)
  36. ),
  37. TP_fast_assign(
  38. __entry->card = substream->pcm->card->number;
  39. __entry->device = substream->pcm->device;
  40. __entry->subdevice = substream->number;
  41. __entry->direction = substream->stream;
  42. __entry->type = type;
  43. __entry->index = index;
  44. __entry->total = substream->runtime->hw_constraints.rules_num;
  45. memcpy(__entry->prev_bits, prev->bits, sizeof(__u32) * 8);
  46. memcpy(__entry->curr_bits, curr->bits, sizeof(__u32) * 8);
  47. ),
  48. TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %08x%08x%08x%08x %08x%08x%08x%08x",
  49. __entry->card,
  50. __entry->device,
  51. __entry->direction ? "c" : "p",
  52. __entry->subdevice,
  53. __entry->index,
  54. __entry->total,
  55. __print_symbolic(__entry->type, hw_param_labels),
  56. __entry->prev_bits[3], __entry->prev_bits[2],
  57. __entry->prev_bits[1], __entry->prev_bits[0],
  58. __entry->curr_bits[3], __entry->curr_bits[2],
  59. __entry->curr_bits[1], __entry->curr_bits[0]
  60. )
  61. );
  62. TRACE_EVENT(hw_interval_param,
  63. TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_hw_param_t type, int index, const struct snd_interval *prev, const struct snd_interval *curr),
  64. TP_ARGS(substream, type, index, prev, curr),
  65. TP_STRUCT__entry(
  66. __field(int, card)
  67. __field(int, device)
  68. __field(int, subdevice)
  69. __field(int, direction)
  70. __field(snd_pcm_hw_param_t, type)
  71. __field(int, index)
  72. __field(int, total)
  73. __field(unsigned int, prev_min)
  74. __field(unsigned int, prev_max)
  75. __field(unsigned int, prev_openmin)
  76. __field(unsigned int, prev_openmax)
  77. __field(unsigned int, prev_integer)
  78. __field(unsigned int, prev_empty)
  79. __field(unsigned int, curr_min)
  80. __field(unsigned int, curr_max)
  81. __field(unsigned int, curr_openmin)
  82. __field(unsigned int, curr_openmax)
  83. __field(unsigned int, curr_integer)
  84. __field(unsigned int, curr_empty)
  85. ),
  86. TP_fast_assign(
  87. __entry->card = substream->pcm->card->number;
  88. __entry->device = substream->pcm->device;
  89. __entry->subdevice = substream->number;
  90. __entry->direction = substream->stream;
  91. __entry->type = type;
  92. __entry->index = index;
  93. __entry->total = substream->runtime->hw_constraints.rules_num;
  94. __entry->prev_min = prev->min;
  95. __entry->prev_max = prev->max;
  96. __entry->prev_openmin = prev->openmin;
  97. __entry->prev_openmax = prev->openmax;
  98. __entry->prev_integer = prev->integer;
  99. __entry->prev_empty = prev->empty;
  100. __entry->curr_min = curr->min;
  101. __entry->curr_max = curr->max;
  102. __entry->curr_openmin = curr->openmin;
  103. __entry->curr_openmax = curr->openmax;
  104. __entry->curr_integer = curr->integer;
  105. __entry->curr_empty = curr->empty;
  106. ),
  107. TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %d %d %s%u %u%s %d %d %s%u %u%s",
  108. __entry->card,
  109. __entry->device,
  110. __entry->direction ? "c" : "p",
  111. __entry->subdevice,
  112. __entry->index,
  113. __entry->total,
  114. __print_symbolic(__entry->type, hw_param_labels),
  115. __entry->prev_empty,
  116. __entry->prev_integer,
  117. __entry->prev_openmin ? "(" : "[",
  118. __entry->prev_min,
  119. __entry->prev_max,
  120. __entry->prev_openmax ? ")" : "]",
  121. __entry->curr_empty,
  122. __entry->curr_integer,
  123. __entry->curr_openmin ? "(" : "[",
  124. __entry->curr_min,
  125. __entry->curr_max,
  126. __entry->curr_openmax ? ")" : "]"
  127. )
  128. );
  129. #endif /* _PCM_PARAMS_TRACE_H */
  130. /* This part must be outside protection */
  131. #undef TRACE_INCLUDE_PATH
  132. #define TRACE_INCLUDE_PATH .
  133. #undef TRACE_INCLUDE_FILE
  134. #define TRACE_INCLUDE_FILE pcm_param_trace
  135. #include <trace/define_trace.h>