lkml.org 
[lkml]   [2007]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC/PATCH] AVR32: Oprofile support
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 <hskinnemoen@atmel.com>

> --- /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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-08 10:35    [W:0.041 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site