From: David Ahern <dsahern@gmail.com>
To: Andrew Davidoff <davidoff@qedmf.net>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: Getting started with perf; a couple of questions
Date: Fri, 07 Jun 2013 09:05:41 -0600 [thread overview]
Message-ID: <51B1F6C5.3060302@gmail.com> (raw)
In-Reply-To: <CAJLXCZSE=LWW8PxTAs4yPAQsmwQjVF=ehGCTKbUWF3rCDF-+7w@mail.gmail.com>
On 6/6/13 12:26 PM, Andrew Davidoff wrote:
> On Thu, Jun 6, 2013 at 8:01 AM, David Ahern <dsahern@gmail.com> wrote:
>>
>> It's a VM and not running on KVM so there is no PMU which means the -e
>> cycles is most likely falling back to -e cpu-clock. You should see this in a
>> message with the -v flag on record. perf-script should dump out the events
>> and show cpu-clock versus cycles.
>>
>> Based on that I suggest trying -e cpu-clock on your original host. If that
>> works then something is messed up with the pmu config on the host.
>
> Thanks. It wasn't clear to me if a VM had the same access to the PMU
> that a non-virtualized host would. But I guess that might explain why
> a bunch of events I'd expect samples for didn't have any (ex:
> iTLB-load-misses), even on the VM that did record some samples?
>
The hypervisor needs to expose a PMU to the guest. AFAIK KVM is the only
one that does that. Without the PMU you do not get H/W based events.
> I re-ran the record on the VM with -v and did see the message about
> falling back to cpu-clock-ticks, but only after I added the cycles
> even to my events list. Which actually leads into a question regarding
> event sampling.
So perf record -v does not show the fallback? The default event has been
'cycles' from the beginning I believe. Only if cycles is not supported
does it fallback to cpu-clock. You should not have to add '-e cycles'.
Well, at least that is the way it is for the code in Linus' tree.
>
> The documentation I have found mentions a "default sampling event"
> (cycles) but doesn't explain the concept of a sampling event in
> detail. Does each event listed with -e have its own sample period/rate
> that can be adjusted? Or do -c or -F apply to all events sampled? Even
> I don't sample cycles, is the default sampling rate still 1000Hz for
> all events sampled in the absence of -c or -F?
Unless it crept it with some changes Jiri made (I have not been using
the fancy -e declarations) I believe there is a single -c/-F argument
and it applies to all events. ie., all events have the same sampling
interval.
The default is 1000 Hz (equivalent to -F 1000). -c specifies the period
-- which is the similar to specifying -F.
OPT_U64('c', "count", &record.opts.user_interval, "event period to
sample"),
...
OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this
frequency"),
And then configuring the attributes for the event only 1 of the 2 is
used with frequency taking precedent:
if (!attr->sample_period || (opts->user_freq != UINT_MAX &&
opts->user_interval != ULLONG_MAX)) {
if (opts->freq) {
perf_evsel__set_sample_bit(evsel, PERIOD);
attr->freq = 1;
attr->sample_freq = opts->freq;
} else {
attr->sample_period = opts->default_interval;
}
}
>
> Regarding using -e cpu-clock on the original host, that doesn't appear
> to have changed the perf record behavior. Neither does using -e
> cycles. And even with -v on record, I didn't see any additional
> messaging (like fall back to cpu-clock). But I do still get sample
> data if I run with -a. *shrug*.
What command lines are you running? I seem to recall this is a 2.6.32
kernel and basic perf record commands should work fine -- perf record -a
or perf record -p <pid>. Perhaps something snuck in recently that broke
compat with 2.6.32. You can determine that by running the perf command
that comes with that version of Ubuntu and then newer ones -- 3.0, 3.4,
3.8 would be a good distribution of versions to start with if you want
to get to the bottom of it.
David
next prev parent reply other threads:[~2013-06-07 15:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 5:26 Getting started with perf; a couple of questions Andrew Davidoff
2013-05-31 5:41 ` David Ahern
2013-05-31 7:09 ` Andrew Davidoff
2013-05-31 20:35 ` Andrew Davidoff
2013-06-06 14:01 ` David Ahern
2013-06-06 18:26 ` Andrew Davidoff
2013-06-07 15:05 ` David Ahern [this message]
2013-06-07 23:49 ` Andrew Davidoff
2013-06-08 0:08 ` David Ahern
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=51B1F6C5.3060302@gmail.com \
--to=dsahern@gmail.com \
--cc=davidoff@qedmf.net \
--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.