On Wed, 07 Nov 2007 at 15:05 +0000, Haavard Skinnemoen wrote:

> This adds the necessary architecture code to run oprofile on AVR32
> using the performance counters documented by the AVR32 Architecture
> Manual.
> 
> Signed-off-by: Haavard Skinnemoen <[EMAIL PROTECTED]>

> --- /dev/null
> +++ b/arch/avr32/oprofile/op_model_avr32.c
> @@ -0,0 +1,235 @@
> +/*


> +static irqreturn_t avr32_perf_counter_interrupt(int irq, void *dev_id)
> +{
> +     struct avr32_perf_counter *ctr = dev_id;
> +     struct pt_regs *regs;
> +     u32 pccr;
> +
> +     if (likely(!(intc_get_pending(AVR32_PERFCTR_IRQ_GROUP)
> +                                     & (1 << AVR32_PERFCTR_IRQ_LINE))))
> +             return IRQ_NONE;
> +
> +     regs = get_irq_regs();
> +     pccr = sysreg_read(PCCR);
> +
> +     /* Clear the interrupt flags we're about to handle */
> +     sysreg_write(PCCR, pccr);
> +
> +     /* PCCNT */
> +     if (ctr->enabled && (pccr & ctr->flag_mask)) {
> +             sysreg_write(PCCNT, -ctr->count);
> +             oprofile_add_sample(regs, PCCNT);
> +     }
> +     ctr++;
> +     /* PCNT0 */
> +     if (ctr->enabled && (pccr & ctr->flag_mask)) {
> +             sysreg_write(PCNT0, -ctr->count);
> +             oprofile_add_sample(regs, PCNT0);
> +     }
> +     ctr++;
> +     /* PCNT1 */
> +     if (ctr->enabled && (pccr & ctr->flag_mask)) {
> +             sysreg_write(PCNT1, -ctr->count);
> +             oprofile_add_sample(regs, PCNT1);
> +     }

Why not a loop here ?

-- 
regards,
Phe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to