blob: 3ddec1b8ae462343d30633929193d352bf56eae3 [file] [log] [blame]
Takashi Iwaif5914902014-11-04 12:45:59 +01001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM snd_pcm
3#define TRACE_INCLUDE_FILE pcm_trace
4
5#if !defined(_PCM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _PCM_TRACE_H
7
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(hwptr,
11 TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_uframes_t pos, bool irq),
12 TP_ARGS(substream, pos, irq),
13 TP_STRUCT__entry(
14 __field( bool, in_interrupt )
15 __field( unsigned int, card )
16 __field( unsigned int, device )
17 __field( unsigned int, number )
18 __field( unsigned int, stream )
19 __field( snd_pcm_uframes_t, pos )
20 __field( snd_pcm_uframes_t, period_size )
21 __field( snd_pcm_uframes_t, buffer_size )
22 __field( snd_pcm_uframes_t, old_hw_ptr )
23 __field( snd_pcm_uframes_t, hw_ptr_base )
24 ),
25 TP_fast_assign(
26 __entry->in_interrupt = (irq);
27 __entry->card = (substream)->pcm->card->number;
28 __entry->device = (substream)->pcm->device;
29 __entry->number = (substream)->number;
30 __entry->stream = (substream)->stream;
31 __entry->pos = (pos);
32 __entry->period_size = (substream)->runtime->period_size;
33 __entry->buffer_size = (substream)->runtime->buffer_size;
34 __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
35 __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
36 ),
Takashi Sakamotof5abd532017-06-12 09:41:46 +090037 TP_printk("pcmC%dD%d%s/sub%d: %s: pos=%lu, old=%lu, base=%lu, period=%lu, buf=%lu",
Takashi Iwaif5914902014-11-04 12:45:59 +010038 __entry->card, __entry->device,
Takashi Sakamotof5abd532017-06-12 09:41:46 +090039 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
Takashi Iwaif5914902014-11-04 12:45:59 +010040 __entry->number,
41 __entry->in_interrupt ? "IRQ" : "POS",
42 (unsigned long)__entry->pos,
43 (unsigned long)__entry->old_hw_ptr,
44 (unsigned long)__entry->hw_ptr_base,
45 (unsigned long)__entry->period_size,
46 (unsigned long)__entry->buffer_size)
47);
48
49TRACE_EVENT(xrun,
50 TP_PROTO(struct snd_pcm_substream *substream),
51 TP_ARGS(substream),
52 TP_STRUCT__entry(
53 __field( unsigned int, card )
54 __field( unsigned int, device )
55 __field( unsigned int, number )
56 __field( unsigned int, stream )
57 __field( snd_pcm_uframes_t, period_size )
58 __field( snd_pcm_uframes_t, buffer_size )
59 __field( snd_pcm_uframes_t, old_hw_ptr )
60 __field( snd_pcm_uframes_t, hw_ptr_base )
61 ),
62 TP_fast_assign(
63 __entry->card = (substream)->pcm->card->number;
64 __entry->device = (substream)->pcm->device;
65 __entry->number = (substream)->number;
66 __entry->stream = (substream)->stream;
67 __entry->period_size = (substream)->runtime->period_size;
68 __entry->buffer_size = (substream)->runtime->buffer_size;
69 __entry->old_hw_ptr = (substream)->runtime->status->hw_ptr;
70 __entry->hw_ptr_base = (substream)->runtime->hw_ptr_base;
71 ),
Takashi Sakamotof5abd532017-06-12 09:41:46 +090072 TP_printk("pcmC%dD%d%s/sub%d: XRUN: old=%lu, base=%lu, period=%lu, buf=%lu",
Takashi Iwaif5914902014-11-04 12:45:59 +010073 __entry->card, __entry->device,
Takashi Sakamotof5abd532017-06-12 09:41:46 +090074 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
Takashi Iwaif5914902014-11-04 12:45:59 +010075 __entry->number,
76 (unsigned long)__entry->old_hw_ptr,
77 (unsigned long)__entry->hw_ptr_base,
78 (unsigned long)__entry->period_size,
79 (unsigned long)__entry->buffer_size)
80);
81
82TRACE_EVENT(hw_ptr_error,
83 TP_PROTO(struct snd_pcm_substream *substream, const char *why),
84 TP_ARGS(substream, why),
85 TP_STRUCT__entry(
86 __field( unsigned int, card )
87 __field( unsigned int, device )
88 __field( unsigned int, number )
89 __field( unsigned int, stream )
90 __field( const char *, reason )
91 ),
92 TP_fast_assign(
93 __entry->card = (substream)->pcm->card->number;
94 __entry->device = (substream)->pcm->device;
95 __entry->number = (substream)->number;
96 __entry->stream = (substream)->stream;
97 __entry->reason = (why);
98 ),
Takashi Sakamotof5abd532017-06-12 09:41:46 +090099 TP_printk("pcmC%dD%d%s/sub%d: ERROR: %s",
Takashi Iwaif5914902014-11-04 12:45:59 +0100100 __entry->card, __entry->device,
Takashi Sakamotof5abd532017-06-12 09:41:46 +0900101 __entry->stream == SNDRV_PCM_STREAM_PLAYBACK ? "p" : "c",
Takashi Iwaif5914902014-11-04 12:45:59 +0100102 __entry->number, __entry->reason)
103);
104
Takashi Sakamotofccf5382017-06-12 09:41:45 +0900105TRACE_EVENT(applptr,
106 TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_uframes_t prev, snd_pcm_uframes_t curr),
107 TP_ARGS(substream, prev, curr),
108 TP_STRUCT__entry(
109 __field( unsigned int, card )
110 __field( unsigned int, device )
111 __field( unsigned int, number )
112 __field( unsigned int, stream )
113 __field( snd_pcm_uframes_t, prev )
114 __field( snd_pcm_uframes_t, curr )
115 __field( snd_pcm_uframes_t, avail )
116 __field( snd_pcm_uframes_t, period_size )
117 __field( snd_pcm_uframes_t, buffer_size )
118 ),
119 TP_fast_assign(
120 __entry->card = (substream)->pcm->card->number;
121 __entry->device = (substream)->pcm->device;
122 __entry->number = (substream)->number;
123 __entry->stream = (substream)->stream;
124 __entry->prev = (prev);
125 __entry->curr = (curr);
126 __entry->avail = (substream)->stream ? snd_pcm_capture_avail(substream->runtime) : snd_pcm_playback_avail(substream->runtime);
127 __entry->period_size = (substream)->runtime->period_size;
128 __entry->buffer_size = (substream)->runtime->buffer_size;
129 ),
130 TP_printk("pcmC%dD%d%s/sub%d: prev=%lu, curr=%lu, avail=%lu, period=%lu, buf=%lu",
131 __entry->card,
132 __entry->device,
133 __entry->stream ? "c" : "p",
134 __entry->number,
135 __entry->prev,
136 __entry->curr,
137 __entry->avail,
138 __entry->period_size,
139 __entry->buffer_size
140 )
141);
142
Takashi Iwaif5914902014-11-04 12:45:59 +0100143#endif /* _PCM_TRACE_H */
144
145/* This part must be outside protection */
146#undef TRACE_INCLUDE_PATH
147#define TRACE_INCLUDE_PATH .
148#include <trace/define_trace.h>