public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Revell <rlrevell@joe-job.com>
To: Remon Sijrier <remon@vt.shuis.tudelft.nl>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Losing interrupts
Date: Fri, 16 Jul 2004 17:00:48 -0400	[thread overview]
Message-ID: <1090011648.30657.9.camel@mindpipe> (raw)
In-Reply-To: <200407161116.38493.remon@vt.shuis.tudelft.nl>

On Fri, 2004-07-16 at 05:16, Remon Sijrier wrote:
> Hello,
> 
> First, thanks a lot for the work done and still done for tackling the latency 
> issues in the kernel.
> 
> I'm interested in this area, and want to do some testing as well.
> Lee Revel, could you please sent me the changes you made for measuring 
> interrupt times to me?
> 

It's pretty sloppy, but it is just debugging code.  This patch is for
emu10k1, you will have to adapt this to your driver (ice1712). 
Basically you just add a couple of fields to the card record to track
the time the last interrupt occurred, and the time elapsed between the
previous two interrupts.  Then, if you launch a program like JACK that
should cause the soundcard interrupts to happen at a fixed interval, you
can use some heuristics to figure out whether you have lost an
interrupt.

Also the fscking tabs below have been mangled to spaces, I am not sure
if this is caused by copying from xterm, or pasting into Evolution, but
I am not too happy about it.

Index: include/emu10k1.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/include/emu10k1.h,v
retrieving revision 1.43
diff -u -r1.43 emu10k1.h
--- include/emu10k1.h   1 Jul 2004 09:22:16 -0000       1.43
+++ include/emu10k1.h   16 Jul 2004 20:54:16 -0000
@@ -1003,6 +1003,9 @@
        emu10k1_midi_t midi2; /* for audigy */
 
        unsigned int efx_voices_mask[2];
+
+       cycles_t last_interrupt_time;
+       int last_delay;
 };
 
 int snd_emu10k1_create(snd_card_t * card,
Index: pci/emu10k1/emupcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emupcm.c,v
retrieving revision 1.29
diff -u -r1.29 emupcm.c
--- pci/emu10k1/emupcm.c        1 Jul 2004 09:22:16 -0000       1.29
+++ pci/emu10k1/emupcm.c        16 Jul 2004 20:51:02 -0000
@@ -37,6 +37,26 @@
 static void snd_emu10k1_pcm_interrupt(emu10k1_t *emu, emu10k1_voice_t *voice)
 {
        emu10k1_pcm_t *epcm;
+       cycles_t then;
+       cycles_t now;
+       int delay;
+       int jitter;
+       
+       then = emu->last_interrupt_time;
+       now = get_cycles ();
+       emu->last_interrupt_time = now;
+       
+       delay = now - then;
+       jitter = abs( delay - emu->last_delay );
+
+       if (jitter > 50000) {
+           printk("IRQ: delay =  %i cycles, jitter = %i\n", delay,  jitter);
+       }
+        if (jitter * 2 > emu->last_delay ) {
+           printk("IRQ: delay =  %i cycles, jitter = %i - missed an interrupt?\n", delay,  jitter);
+       }
+           
+       emu->last_delay = delay;
 
        if ((epcm = voice->epcm) == NULL)
                return;
@@ -816,6 +836,8 @@
        mix->send_volume[1][0] = mix->send_volume[2][1] = 255;
        mix->attn[0] = mix->attn[1] = mix->attn[2] = 0xffff;
        mix->epcm = epcm;
+       emu->last_interrupt_time = 0;
+       emu->last_delay = 0;
        snd_emu10k1_pcm_mixer_notify(emu, substream->number, 1);
        return 0;
 }

Lee


  reply	other threads:[~2004-07-16 21:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-16  9:16 Losing interrupts Remon Sijrier
2004-07-16 21:00 ` Lee Revell [this message]
2004-07-17 13:29   ` Remon Sijrier
  -- strict thread matches above, loose matches on Subject: below --
2004-07-14 22:19 Lee Revell
2004-07-15 21:36 ` Lee Revell
2004-07-15 21:04   ` Andrew Morton
2004-07-16  3:24 ` Lee Revell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1090011648.30657.9.camel@mindpipe \
    --to=rlrevell@joe-job.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=remon@vt.shuis.tudelft.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox