pcm_param_trace.h 4.5 KB

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