lkml.org 
[lkml]   [2015]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] x86, perf: Add an aperfmperf driver
On Wed, Apr 29, 2015 at 06:17:05PM -0700, Andy Lutomirski wrote:
> >> > + /* no sampling */
> >> > + if (event->hw.sample_period)
> >> > + return -EINVAL;
> >>
> >> You could have set pmu::capabilities =
> >> PERF_PMU_CAP_NO_INTERRUPT which would also have killed that dead.
> >
> >
> > That checks attr.sample_period. I'm a bit confused about the
> > relationship between event->hw and event->attr. Do I not need to
> > check hw.sample_period?

event->attr is the perf_event_attr used to instantiate the event.
event->hw is the hardware/working state of the event.

You'll notice that attr::sample_period is part of a union and when
!attr::freq will be used as the actual hw::sample_period. However when
attr::freq we'll compute hw::sample_period based on actual event rates
such that we'll approx attr::sample_freq.

Setting pmu::capabilities = PERF_PMU_CAP_NO_INTERRUPT would be the best
solution here.

> > Before I submit v2, do you think this is actually worth doing? I can
> > see it being useful for answering questions like "did this workload
> > end up running at full speed".
> >
>
> To clarify, this is partially redundant with "cpu-cycles" and
> "ref-cycles". That being said, these are simpler, actually documented
> as being appropriate for measuring cpu performance states, and don't
> have any scheduling constraints.

On the whole useful question; I dunno. It seems like something worth
providing for the reasons you state. But I don't really get around to
doing much userspace these days so I might not be the best to answer
this.

Also, you could extend this with IA32_PPERF (Skylake and later, see
SDM-201501 book 3 section 14.4.5.1).

> Also, is perf stat able to count while idle? perf stat -a -e
> cpu-cycles sleep 1 reports very small numbers.

Yes, perf stat -a (iow cpu events) should count while idle, note however
that not all events count during halt, so its very much event dependent.


\
 
 \ /
  Last update: 2015-04-30 11:01    [W:0.056 / U:2.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site