The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Philippe Elie <phil.el@wanadoo.fr>
To: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: oprofile-list@lists.sourceforge.net, kernel@avr32linux.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH] AVR32: Oprofile support
Date: Thu, 8 Nov 2007 10:28:06 +0100	[thread overview]
Message-ID: <20071108092806.GB2889@zaniah> (raw)
In-Reply-To: <1194444333-9264-1-git-send-email-hskinnemoen@atmel.com>

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


  parent reply	other threads:[~2007-11-08  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 14:05 [RFC/PATCH] AVR32: Oprofile support Haavard Skinnemoen
2007-11-07 15:55 ` Philippe Elie
2007-11-07 18:41   ` Haavard Skinnemoen
2007-11-08  9:28 ` Philippe Elie [this message]
2007-11-08 11:14   ` Haavard Skinnemoen
2007-11-08 12:25     ` Philippe Elie

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=20071108092806.GB2889@zaniah \
    --to=phil.el@wanadoo.fr \
    --cc=hskinnemoen@atmel.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oprofile-list@lists.sourceforge.net \
    /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