diff options
author | Ben Gardiner <bengardiner@nanometrics.ca> | 2011-05-18 10:03:34 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-18 11:12:39 -0400 |
commit | ec08b14483de0702ca43e3a8506e149486975f9b (patch) | |
tree | 8519bc5afc22b259886aa775bef402dd51378601 /sound/core | |
parent | 7cdd8d73139ec935a8e91806131a5b91e26c653e (diff) |
ALSA: sound, core, pcm_lib: xrun_log: log also in_interrupt
When debugging pcm drivers I found the "period" or "hw" prefix printed
by either XRUN_DEBUG_PERIODUPDATE or XRUN_DEBUG_PERIODUPDATE events,
respectively to be very useful is observing the interplay between
interrupt-context updates and syscall-context updates.
Similarly, when debugging overruns with XRUN_DEBUG_LOG it is useful to
see the context of the last 10 positions.
Add an in_interrupt member to hwptr_log_entry which stores the value of
the in_interrupt parameter of snd_pcm_update_hw_ptr0 when the log entry
is created. Print a "[Q]" prefix when dumping the log entries if
in_interrupt was true.
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 64449cb8f873..c8c8091f9a71 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -189,6 +189,7 @@ static void xrun(struct snd_pcm_substream *substream) | |||
189 | #define XRUN_LOG_CNT 10 | 189 | #define XRUN_LOG_CNT 10 |
190 | 190 | ||
191 | struct hwptr_log_entry { | 191 | struct hwptr_log_entry { |
192 | unsigned int in_interrupt; | ||
192 | unsigned long jiffies; | 193 | unsigned long jiffies; |
193 | snd_pcm_uframes_t pos; | 194 | snd_pcm_uframes_t pos; |
194 | snd_pcm_uframes_t period_size; | 195 | snd_pcm_uframes_t period_size; |
@@ -204,7 +205,7 @@ struct snd_pcm_hwptr_log { | |||
204 | }; | 205 | }; |
205 | 206 | ||
206 | static void xrun_log(struct snd_pcm_substream *substream, | 207 | static void xrun_log(struct snd_pcm_substream *substream, |
207 | snd_pcm_uframes_t pos) | 208 | snd_pcm_uframes_t pos, int in_interrupt) |
208 | { | 209 | { |
209 | struct snd_pcm_runtime *runtime = substream->runtime; | 210 | struct snd_pcm_runtime *runtime = substream->runtime; |
210 | struct snd_pcm_hwptr_log *log = runtime->hwptr_log; | 211 | struct snd_pcm_hwptr_log *log = runtime->hwptr_log; |
@@ -220,6 +221,7 @@ static void xrun_log(struct snd_pcm_substream *substream, | |||
220 | return; | 221 | return; |
221 | } | 222 | } |
222 | entry = &log->entries[log->idx]; | 223 | entry = &log->entries[log->idx]; |
224 | entry->in_interrupt = in_interrupt; | ||
223 | entry->jiffies = jiffies; | 225 | entry->jiffies = jiffies; |
224 | entry->pos = pos; | 226 | entry->pos = pos; |
225 | entry->period_size = runtime->period_size; | 227 | entry->period_size = runtime->period_size; |
@@ -246,9 +248,11 @@ static void xrun_log_show(struct snd_pcm_substream *substream) | |||
246 | entry = &log->entries[idx]; | 248 | entry = &log->entries[idx]; |
247 | if (entry->period_size == 0) | 249 | if (entry->period_size == 0) |
248 | break; | 250 | break; |
249 | snd_printd("hwptr log: %s: j=%lu, pos=%ld/%ld/%ld, " | 251 | snd_printd("hwptr log: %s: %sj=%lu, pos=%ld/%ld/%ld, " |
250 | "hwptr=%ld/%ld\n", | 252 | "hwptr=%ld/%ld\n", |
251 | name, entry->jiffies, (unsigned long)entry->pos, | 253 | name, entry->in_interrupt ? "[Q] " : "", |
254 | entry->jiffies, | ||
255 | (unsigned long)entry->pos, | ||
252 | (unsigned long)entry->period_size, | 256 | (unsigned long)entry->period_size, |
253 | (unsigned long)entry->buffer_size, | 257 | (unsigned long)entry->buffer_size, |
254 | (unsigned long)entry->old_hw_ptr, | 258 | (unsigned long)entry->old_hw_ptr, |
@@ -326,7 +330,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
326 | } | 330 | } |
327 | pos -= pos % runtime->min_align; | 331 | pos -= pos % runtime->min_align; |
328 | if (xrun_debug(substream, XRUN_DEBUG_LOG)) | 332 | if (xrun_debug(substream, XRUN_DEBUG_LOG)) |
329 | xrun_log(substream, pos); | 333 | xrun_log(substream, pos, in_interrupt); |
330 | hw_base = runtime->hw_ptr_base; | 334 | hw_base = runtime->hw_ptr_base; |
331 | new_hw_ptr = hw_base + pos; | 335 | new_hw_ptr = hw_base + pos; |
332 | if (in_interrupt) { | 336 | if (in_interrupt) { |