Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Jonathan Day <imipak@yahoo.com>
Cc: linux-mips@linux-mips.org
Subject: Re: Performance counters and profiling on MIPS
Date: Mon, 12 Jun 2006 23:58:48 +0100	[thread overview]
Message-ID: <20060612225848.GA7163@linux-mips.org> (raw)
In-Reply-To: <20060607172252.47981.qmail@web31512.mail.mud.yahoo.com>

On Wed, Jun 07, 2006 at 10:22:52AM -0700, Jonathan Day wrote:

> Two quick and semi-related questions for the Gurus of
> the MIPS. First off, it would appear that profiling on
> any of the Broadcom MIPS processors is broken. I get
> the following warnings when compiling the
> platform-specific irq.c file:

This is ZBus-based profiling which also isn't supported by the standard
profiling tool oprofile.  Oprofile is using the performance counters of
the processor itself.

> My second question is with regards to accessing the
> performance counters and timestamp counters from
> userspace. On some architectures, this is as simple as
> using a single macro.
> 
> In the case of the ix86 architecture (yuk!), the
> timestamp counters can be read with nothing more than
> an rdtsc() call, as follows:
> 
> asm volatile ("rdtsc" : "=a"(*(elg_ui4
> *)&clock_value),
>                 "=d"(*(((elg_ui4 *)&clock_value)+1)));
> 
> What is the closest equiv. for the MIPS processors?

On most R4000-style processors (that includes the SB1 core of the Sibyte
chips) applications can access the cycle counter through an
mfc0 $reg, $c0_count instruction.  However mfc0 is a priviledged
instruction, so that doesn't work for code that doesn't have kernel
priviledges.

For release 2 of the MISP32 / MIPS64 architecture there is a new
instruction, rdhwr which an application - so the OS permits it - can
use to read c0_count.

Now there are two problems with that approach in your case:

 o SB1 implements release 0.95 of the MIPS64 architecture, SB1A release 1.
   Iow these cores don't have rdhwr.
 o In general on a multiprocessor system you don't have a guarantee that
   the count registers of all processors are running at the same speed or
   were set to the same value at any time.
      This is more of a general problem; in case of the BCM1250 the cores
   are actually running at the same speed and afair are synchronized by
   the reset.

  Ralf

  reply	other threads:[~2006-06-12 22:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 17:22 Performance counters and profiling on MIPS Jonathan Day
2006-06-12 22:58 ` Ralf Baechle [this message]
2006-06-13 21:27   ` Jonathan Day
2006-06-13 21:44     ` Prasad Boddupalli
2006-06-13 22:57       ` Nigel Stephens
2006-06-14 18:14         ` Jonathan Day
2006-09-17 21:08           ` Philip Mucci

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=20060612225848.GA7163@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=imipak@yahoo.com \
    --cc=linux-mips@linux-mips.org \
    /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