Linux Perf Users
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Keno Fischer <kfischer@college.harvard.edu>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Sampling hardware counter values with timers
Date: Fri, 13 May 2016 06:40:41 -0700	[thread overview]
Message-ID: <87vb2ikrdy.fsf@tassilo.jf.intel.com> (raw)
In-Reply-To: <CAEoGj_-43BRwknevsRtZWpwLuF5sh=mYs5J36swowB17FwkWxg@mail.gmail.com> (Keno Fischer's message of "Fri, 13 May 2016 00:00:16 -0400")

Keno Fischer <kfischer@college.harvard.edu> writes:

> Hello everyone,
>
> I was wondering if it is possible (either using the `perf` user space
> tool or using the perf_events API) to periodically sample the value of
> a hardware counter (in my particular case I'd like to sample the
> retired-branch-counter). I know it is possible to do the opposite
> (i.e. sample a timestamp every specified number of branches), but I
> wasn't able to see an easy way to sample the hardware counter at a
> specified frequency. Is this possible?

perf record works this way by default. The counter period is dynamically
adjusted for a given frequency. The default frequency is 1000.
You can set it with -F.

Another alternative is to use perf stat -I ... if you only need the counts.

-Andi

  reply	other threads:[~2016-05-13 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13  4:00 Sampling hardware counter values with timers Keno Fischer
2016-05-13 13:40 ` Andi Kleen [this message]
2016-05-13 14:44   ` Keno Fischer
2016-05-13 17:42     ` Vince Weaver
2016-05-13 18:26       ` Keno Fischer

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=87vb2ikrdy.fsf@tassilo.jf.intel.com \
    --to=andi@firstfloor.org \
    --cc=kfischer@college.harvard.edu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox