/** * Get one frame from the jitter buffer * * @param jb Jitter buffer * @param hdr Returned RTP Header * @param mem Pointer to memory object storage - referenced on success * * @return 0 if success, otherwise errorcode */ int jbuf_get(struct jbuf *jb, struct rtp_header *hdr, void **mem) { struct frame *f; if (!jb || !hdr || !mem) return EINVAL; STAT_INC(n_get); if (jb->n <= jb->min || !jb->framel.head) { DEBUG_INFO("not enough buffer frames - wait.. (n=%u min=%u)\n", jb->n, jb->min); STAT_INC(n_underflow); return ENOENT; } /* When we get one frame F[i], check that the next frame F[i+1] is present and have a seq no. of seq[i] + 1 ! if not, we should consider that packet lost */ f = jb->framel.head->data; #if JBUF_STAT /* Check timestamp of previously played frame */ if (jb->seq_get) { const int16_t seq_diff = f->hdr.seq - jb->seq_get; if (seq_less(f->hdr.seq, jb->seq_get)) { DEBUG_WARNING("get: seq=%u too late\n", f->hdr.seq); } else if (seq_diff > 1) { STAT_ADD(n_lost, 1); DEBUG_INFO("get: n_lost: diff=%d,seq=%u,seq_get=%u\n", seq_diff, f->hdr.seq, jb->seq_get); } } /* Update sequence number for 'get' */ jb->seq_get = f->hdr.seq; #endif *hdr = f->hdr; *mem = mem_ref(f->mem); frame_deref(jb, f); return 0; }
irqreturn_t snd_gus_interrupt(int irq, void *dev_id) { struct snd_gus_card * gus = dev_id; unsigned char status; int loop = 100; int handled = 0; __again: status = inb(gus->gf1.reg_irqstat); if (status == 0) return IRQ_RETVAL(handled); handled = 1; // snd_printk("IRQ: status = 0x%x\n", status); if (status & 0x02) { STAT_ADD(gus->gf1.interrupt_stat_midi_in); if (gus->gf1.interrupt_handler_midi_in) gus->gf1.interrupt_handler_midi_in(gus); } if (status & 0x01) { STAT_ADD(gus->gf1.interrupt_stat_midi_out); if (gus->gf1.interrupt_handler_midi_out) gus->gf1.interrupt_handler_midi_out(gus); } if (status & (0x20 | 0x40)) { unsigned int already, _current_; unsigned char voice_status, voice; struct snd_gus_voice *pvoice; already = 0; while (((voice_status = snd_gf1_i_read8(gus, SNDRV_GF1_GB_VOICES_IRQ)) & 0xc0) != 0xc0) { voice = voice_status & 0x1f; _current_ = 1 << voice; if (already & _current_) continue; /* multi request */ already |= _current_; /* mark request */ #if 0 printk("voice = %i, voice_status = 0x%x, voice_verify = %i\n", voice, voice_status, inb(GUSP(gus, GF1PAGE))); #endif pvoice = &gus->gf1.voices[voice]; if (pvoice->use) { if (!(voice_status & 0x80)) { /* voice position IRQ */ STAT_ADD(pvoice->interrupt_stat_wave); pvoice->handler_wave(gus, pvoice); } if (!(voice_status & 0x40)) { /* volume ramp IRQ */ STAT_ADD(pvoice->interrupt_stat_volume); pvoice->handler_volume(gus, pvoice); } } else { STAT_ADD(gus->gf1.interrupt_stat_voice_lost); snd_gf1_i_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); snd_gf1_i_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); } } } if (status & 0x04) { STAT_ADD(gus->gf1.interrupt_stat_timer1); if (gus->gf1.interrupt_handler_timer1) gus->gf1.interrupt_handler_timer1(gus); } if (status & 0x08) { STAT_ADD(gus->gf1.interrupt_stat_timer2); if (gus->gf1.interrupt_handler_timer2) gus->gf1.interrupt_handler_timer2(gus); } if (status & 0x80) { if (snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL) & 0x40) { STAT_ADD(gus->gf1.interrupt_stat_dma_write); if (gus->gf1.interrupt_handler_dma_write) gus->gf1.interrupt_handler_dma_write(gus); } if (snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL) & 0x40) { STAT_ADD(gus->gf1.interrupt_stat_dma_read); if (gus->gf1.interrupt_handler_dma_read) gus->gf1.interrupt_handler_dma_read(gus); } } if (--loop > 0) goto __again; return IRQ_NONE; }
irqreturn_t snd_gus_interrupt(int irq, void *dev_id) { struct snd_gus_card * gus = dev_id; unsigned char status; int loop = 100; int handled = 0; __again: status = inb(gus->gf1.reg_irqstat); if (status == 0) return IRQ_RETVAL(handled); handled = 1; #ifdef CONFIG_DEBUG_PRINTK /* snd_printk(KERN_DEBUG "IRQ: status = 0x%x\n", status); */ #else /* ; #endif if (status & 0x02) { STAT_ADD(gus->gf1.interrupt_stat_midi_in); if (gus->gf1.interrupt_handler_midi_in) gus->gf1.interrupt_handler_midi_in(gus); } if (status & 0x01) { STAT_ADD(gus->gf1.interrupt_stat_midi_out); if (gus->gf1.interrupt_handler_midi_out) gus->gf1.interrupt_handler_midi_out(gus); } if (status & (0x20 | 0x40)) { unsigned int already, _current_; unsigned char voice_status, voice; struct snd_gus_voice *pvoice; already = 0; while (((voice_status = snd_gf1_i_read8(gus, SNDRV_GF1_GB_VOICES_IRQ)) & 0xc0) != 0xc0) { voice = voice_status & 0x1f; _current_ = 1 << voice; if (already & _current_) continue; /* multi request */ already |= _current_; /* mark request */ #if 0 #ifdef CONFIG_DEBUG_PRINTK printk(KERN_DEBUG "voice = %i, voice_status = 0x%x, " "voice_verify = %i\n", voice, voice_status, inb(GUSP(gus, GF1PAGE))); #else ; #endif #endif pvoice = &gus->gf1.voices[voice]; if (pvoice->use) { if (!(voice_status & 0x80)) { /* voice position IRQ */ STAT_ADD(pvoice->interrupt_stat_wave); pvoice->handler_wave(gus, pvoice); } if (!(voice_status & 0x40)) { /* volume ramp IRQ */ STAT_ADD(pvoice->interrupt_stat_volume); pvoice->handler_volume(gus, pvoice); } } else { STAT_ADD(gus->gf1.interrupt_stat_voice_lost); snd_gf1_i_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); snd_gf1_i_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); } }
void CheckpointService::StatSetUpHandler::operator()(StatTable &stat) { StatTable::ParamId parentId; parentId = STAT_TABLE_ROOT; stat.resolveGroup(parentId, STAT_TABLE_CP, "checkpoint"); parentId = STAT_TABLE_CP; STAT_ADD(STAT_TABLE_CP_START_TIME); STAT_ADD(STAT_TABLE_CP_END_TIME); STAT_ADD(STAT_TABLE_CP_MODE); STAT_ADD(STAT_TABLE_CP_PENDING_PARTITION); STAT_ADD(STAT_TABLE_CP_NORMAL_CHECKPOINT_OPERATION); STAT_ADD(STAT_TABLE_CP_REQUESTED_CHECKPOINT_OPERATION); parentId = STAT_TABLE_ROOT; stat.resolveGroup(parentId, STAT_TABLE_PERF, "performance"); parentId = STAT_TABLE_PERF; STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_FILE_SIZE); STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_FILE_USAGE_RATE); STAT_ADD(STAT_TABLE_PERF_CURRENT_CHECKPOINT_WRITE_BUFFER_SIZE); STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_WRITE_SIZE); STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_WRITE_TIME); STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_MEMORY_LIMIT); STAT_ADD(STAT_TABLE_PERF_CHECKPOINT_MEMORY); }