public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH/RFC 2/2] perfcounters: add an mmap method to allow userspace to read hardware counters
Date: Tue, 17 Mar 2009 08:38:35 +0100	[thread overview]
Message-ID: <1237275515.5189.71.camel@laptop> (raw)
In-Reply-To: <18879.14431.733358.248755@drongo.ozlabs.ibm.com>

On Tue, 2009-03-17 at 16:42 +1100, Paul Mackerras wrote:
> Impact: new feature giving performance improvement
> 
> This adds the ability for userspace to do an mmap on a hardware counter
> fd and get access to a read-only page that contains the information
> needed to translate a hardware counter value to the full 64-bit
> counter value that would be returned by a read on the fd.  This is
> useful on architectures that allow user programs to read the hardware
> counters, such as PowerPC.
> 
> The mmap will only succeed if the counter is a hardware counter
> monitoring the current process.
> 
> On my quad 2.5GHz PowerPC 970MP machine, userspace can read a counter
> and translate it to the full 64-bit value in about 30ns using the
> mmapped page, compared to about 830ns for the read syscall on the
> counter, so this does give a significant performance improvement.

While I think mmap'ed counters is a great idea, I really dont like this
patch. It adds a second output format unrelated to the regular output
format, and it doesn't appear to honor the regular output rules either.
PERF_RECORD_GROUP thingies won't work for example.

Nor is there any kind of queuing, one might want to have multiple events
in the mmap buffer..

I was planning to do this after cleaning up the normal output bits, as
our current output stuff is a mess:
 - its spread out over arch code (seems daft to me, we should all output
   the same)
 - its useless for pretty much anything but the two apps we currently
   have

In particular, it lacks the tid information for sampled data I hinted to
in the previous email.

Furthermore, in order to reliably profile userspace we need mmap
information in the output stream as well.




  reply	other threads:[~2009-03-17  7:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17  5:42 [PATCH/RFC 2/2] perfcounters: add an mmap method to allow userspace to read hardware counters Paul Mackerras
2009-03-17  7:38 ` Peter Zijlstra [this message]
2009-03-17  8:27   ` Paul Mackerras
2009-03-17  8:41     ` Peter Zijlstra
2009-03-17  9:24       ` Paul Mackerras

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=1237275515.5189.71.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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