0001
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM snd_pcm
0004 #define TRACE_INCLUDE_FILE pcm_trace
0005
0006 #if !defined(_PCM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
0007 #define _PCM_TRACE_H
0008
0009 #include <linux/tracepoint.h>
0010
0011 TRACE_EVENT(hwptr,
0012 TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_uframes_t pos, bool irq),
0013 TP_ARGS(substream, pos, irq),
0014 TP_STRUCT__entry(
0015 __field( bool, in_interrupt )
0016 __field( unsigned int, card )
0017 __field( unsigned int, device )
0018 __field( unsigned int, number )
0019 __field( unsigned int, stream )
0020 __field( snd_pcm_uframes_t, pos )
0021 __field( snd_pcm_uframes_t, period_size )
0022 __field( snd_pcm_uframes_t, buffer_size )
0023 __field( snd_pcm_uframes_t, old_hw_ptr )
0024 __field( snd_pcm_uframes_t, hw_ptr_base )
0025 ),
0026 TP_fast_assign(
0027 __entry->in_interrupt = (irq);
0028 __entry->card = (substream)->pcm->card->number;
0029 __entry->device = (substream)->pcm->device;
0030 __entry->number = (substream)->number;
0031 __entry->stream = (substream)->stream;
0032 __entry->pos = (pos);
0033 __entry->period_size = (substream)->runtime->period_size;
0034 __entry->buffer_size = (substream)->runtime->buffer_size;
0035 __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
0036 __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
0037 ),
0038 TP_printk("pcmC%dD%d%s/sub%d: %s: pos=%lu, old=%lu, base=%lu, period=%lu, buf=%lu",
0039 __entry->card, __entry->device,
0040 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
0041 __entry->number,
0042 __entry->in_interrupt ? "IRQ" : "POS",
0043 (unsigned long)__entry->pos,
0044 (unsigned long)__entry->old_hw_ptr,
0045 (unsigned long)__entry->hw_ptr_base,
0046 (unsigned long)__entry->period_size,
0047 (unsigned long)__entry->buffer_size)
0048 );
0049
0050 TRACE_EVENT(xrun,
0051 TP_PROTO(struct snd_pcm_substream *substream),
0052 TP_ARGS(substream),
0053 TP_STRUCT__entry(
0054 __field( unsigned int, card )
0055 __field( unsigned int, device )
0056 __field( unsigned int, number )
0057 __field( unsigned int, stream )
0058 __field( snd_pcm_uframes_t, period_size )
0059 __field( snd_pcm_uframes_t, buffer_size )
0060 __field( snd_pcm_uframes_t, old_hw_ptr )
0061 __field( snd_pcm_uframes_t, hw_ptr_base )
0062 ),
0063 TP_fast_assign(
0064 __entry->card = (substream)->pcm->card->number;
0065 __entry->device = (substream)->pcm->device;
0066 __entry->number = (substream)->number;
0067 __entry->stream = (substream)->stream;
0068 __entry->period_size = (substream)->runtime->period_size;
0069 __entry->buffer_size = (substream)->runtime->buffer_size;
0070 __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
0071 __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
0072 ),
0073 TP_printk("pcmC%dD%d%s/sub%d: XRUN: old=%lu, base=%lu, period=%lu, buf=%lu",
0074 __entry->card, __entry->device,
0075 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
0076 __entry->number,
0077 (unsigned long)__entry->old_hw_ptr,
0078 (unsigned long)__entry->hw_ptr_base,
0079 (unsigned long)__entry->period_size,
0080 (unsigned long)__entry->buffer_size)
0081 );
0082
0083 TRACE_EVENT(hw_ptr_error,
0084 TP_PROTO(struct snd_pcm_substream *substream, const char *why),
0085 TP_ARGS(substream, why),
0086 TP_STRUCT__entry(
0087 __field( unsigned int, card )
0088 __field( unsigned int, device )
0089 __field( unsigned int, number )
0090 __field( unsigned int, stream )
0091 __field( const char *, reason )
0092 ),
0093 TP_fast_assign(
0094 __entry->card = (substream)->pcm->card->number;
0095 __entry->device = (substream)->pcm->device;
0096 __entry->number = (substream)->number;
0097 __entry->stream = (substream)->stream;
0098 __entry->reason = (why);
0099 ),
0100 TP_printk("pcmC%dD%d%s/sub%d: ERROR: %s",
0101 __entry->card, __entry->device,
0102 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
0103 __entry->number, __entry->reason)
0104 );
0105
0106 TRACE_EVENT(applptr,
0107 TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_uframes_t prev, snd_pcm_uframes_t curr),
0108 TP_ARGS(substream, prev, curr),
0109 TP_STRUCT__entry(
0110 __field( unsigned int, card )
0111 __field( unsigned int, device )
0112 __field( unsigned int, number )
0113 __field( unsigned int, stream )
0114 __field( snd_pcm_uframes_t, prev )
0115 __field( snd_pcm_uframes_t, curr )
0116 __field( snd_pcm_uframes_t, avail )
0117 __field( snd_pcm_uframes_t, period_size )
0118 __field( snd_pcm_uframes_t, buffer_size )
0119 ),
0120 TP_fast_assign(
0121 __entry->card = (substream)->pcm->card->number;
0122 __entry->device = (substream)->pcm->device;
0123 __entry->number = (substream)->number;
0124 __entry->stream = (substream)->stream;
0125 __entry->prev = (prev);
0126 __entry->curr = (curr);
0127 __entry->avail = (substream)->stream ? snd_pcm_capture_avail(substream->runtime) : snd_pcm_playback_avail(substream->runtime);
0128 __entry->period_size = (substream)->runtime->period_size;
0129 __entry->buffer_size = (substream)->runtime->buffer_size;
0130 ),
0131 TP_printk("pcmC%dD%d%s/sub%d: prev=%lu, curr=%lu, avail=%lu, period=%lu, buf=%lu",
0132 __entry->card,
0133 __entry->device,
0134 __entry->stream ? "c" : "p",
0135 __entry->number,
0136 __entry->prev,
0137 __entry->curr,
0138 __entry->avail,
0139 __entry->period_size,
0140 __entry->buffer_size
0141 )
0142 );
0143
0144 #endif
0145
0146
0147 #undef TRACE_INCLUDE_PATH
0148 #define TRACE_INCLUDE_PATH .
0149 #include <trace/define_trace.h>