All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Jesper Dangaard Brouer <jbrouer@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	linux-perf-users@vger.kernel.org,
	Daniel Borkmann <dborkman@redhat.com>,
	Florian Westphal <fw@strlen.de>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: Re: Use of PMU counters inside kernel?
Date: Thu, 19 Jun 2014 14:11:59 -0700	[thread overview]
Message-ID: <87d2e48uzk.fsf@tassilo.jf.intel.com> (raw)
In-Reply-To: <20140619125352.768e1ec9@redhat.com> (Jesper Dangaard Brouer's message of "Thu, 19 Jun 2014 12:53:52 +0200")

Jesper Dangaard Brouer <jbrouer@redhat.com> writes:

> I want to use/read the PMU counters for 'instructions' and 'cycles',
> from within the kernel, to measure the overhead of different in-kernel
> functions (and calc the pipeline efficiency ala perf-stat insns per cycle).
>
> What is the prefered way/API to read these counters, without
> conflicting with the perf tool?
>

perf_event_create_counter()


> I basically just need a in-kernel API to turn in these counters, and
> then I can just read them via the rdpcm instruction.

For RDPMC you would need extra support actually, as there is no 
guarantee perf uses the fixed counter. In user space this 
information is in the perf mmap page.

Also please be aware that RDPMC is not synchronizing.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

  reply	other threads:[~2014-06-19 21:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 10:53 Use of PMU counters inside kernel? Jesper Dangaard Brouer
2014-06-19 21:11 ` Andi Kleen [this message]
2014-06-20 11:04   ` Jesper Dangaard Brouer

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=87d2e48uzk.fsf@tassilo.jf.intel.com \
    --to=andi@firstfloor.org \
    --cc=acme@redhat.com \
    --cc=dborkman@redhat.com \
    --cc=fw@strlen.de \
    --cc=hannes@stressinduktion.org \
    --cc=jbrouer@redhat.com \
    --cc=linux-perf-users@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.