pcm_trace.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM snd_pcm
  3. #define TRACE_INCLUDE_FILE pcm_trace
  4. #if !defined(_PCM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _PCM_TRACE_H
  6. #include <linux/tracepoint.h>
  7. TRACE_EVENT(hwptr,
  8. TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_uframes_t pos, bool irq),
  9. TP_ARGS(substream, pos, irq),
  10. TP_STRUCT__entry(
  11. __field( bool, in_interrupt )
  12. __field( unsigned int, card )
  13. __field( unsigned int, device )
  14. __field( unsigned int, number )
  15. __field( unsigned int, stream )
  16. __field( snd_pcm_uframes_t, pos )
  17. __field( snd_pcm_uframes_t, period_size )
  18. __field( snd_pcm_uframes_t, buffer_size )
  19. __field( snd_pcm_uframes_t, old_hw_ptr )
  20. __field( snd_pcm_uframes_t, hw_ptr_base )
  21. ),
  22. TP_fast_assign(
  23. __entry->in_interrupt = (irq);
  24. __entry->card = (substream)->pcm->card->number;
  25. __entry->device = (substream)->pcm->device;
  26. __entry->number = (substream)->number;
  27. __entry->stream = (substream)->stream;
  28. __entry->pos = (pos);
  29. __entry->period_size = (substream)->runtime->period_size;
  30. __entry->buffer_size = (substream)->runtime->buffer_size;
  31. __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
  32. __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
  33. ),
  34. TP_printk("pcmC%dD%d%c/sub%d: %s: pos=%lu, old=%lu, base=%lu, period=%lu, buf=%lu",
  35. __entry->card, __entry->device,
  36. __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c',
  37. __entry->number,
  38. __entry->in_interrupt ? "IRQ" : "POS",
  39. (unsigned long)__entry->pos,
  40. (unsigned long)__entry->old_hw_ptr,
  41. (unsigned long)__entry->hw_ptr_base,
  42. (unsigned long)__entry->period_size,
  43. (unsigned long)__entry->buffer_size)
  44. );
  45. TRACE_EVENT(xrun,
  46. TP_PROTO(struct snd_pcm_substream *substream),
  47. TP_ARGS(substream),
  48. TP_STRUCT__entry(
  49. __field( unsigned int, card )
  50. __field( unsigned int, device )
  51. __field( unsigned int, number )
  52. __field( unsigned int, stream )
  53. __field( snd_pcm_uframes_t, period_size )
  54. __field( snd_pcm_uframes_t, buffer_size )
  55. __field( snd_pcm_uframes_t, old_hw_ptr )
  56. __field( snd_pcm_uframes_t, hw_ptr_base )
  57. ),
  58. TP_fast_assign(
  59. __entry->card = (substream)->pcm->card->number;
  60. __entry->device = (substream)->pcm->device;
  61. __entry->number = (substream)->number;
  62. __entry->stream = (substream)->stream;
  63. __entry->period_size = (substream)->runtime->period_size;
  64. __entry->buffer_size = (substream)->runtime->buffer_size;
  65. __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
  66. __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
  67. ),
  68. TP_printk("pcmC%dD%d%c/sub%d: XRUN: old=%lu, base=%lu, period=%lu, buf=%lu",
  69. __entry->card, __entry->device,
  70. __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c',
  71. __entry->number,
  72. (unsigned long)__entry->old_hw_ptr,
  73. (unsigned long)__entry->hw_ptr_base,
  74. (unsigned long)__entry->period_size,
  75. (unsigned long)__entry->buffer_size)
  76. );
  77. TRACE_EVENT(hw_ptr_error,
  78. TP_PROTO(struct snd_pcm_substream *substream, const char *why),
  79. TP_ARGS(substream, why),
  80. TP_STRUCT__entry(
  81. __field( unsigned int, card )
  82. __field( unsigned int, device )
  83. __field( unsigned int, number )
  84. __field( unsigned int, stream )
  85. __field( const char *, reason )
  86. ),
  87. TP_fast_assign(
  88. __entry->card = (substream)->pcm->card->number;
  89. __entry->device = (substream)->pcm->device;
  90. __entry->number = (substream)->number;
  91. __entry->stream = (substream)->stream;
  92. __entry->reason = (why);
  93. ),
  94. TP_printk("pcmC%dD%d%c/sub%d: ERROR: %s",
  95. __entry->card, __entry->device,
  96. __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c',
  97. __entry->number, __entry->reason)
  98. );
  99. #endif /* _PCM_TRACE_H */
  100. /* This part must be outside protection */
  101. #undef TRACE_INCLUDE_PATH
  102. #define TRACE_INCLUDE_PATH .
  103. #include <trace/define_trace.h>