Re: [RFC/PATCH] AVR32: Oprofile support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux