lkml.org 
[lkml]   [2010]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 3/5] perf: Add hrtimer code for PMI-less hardware counters
On Mon, Aug 30, 2010 at 04:12:24PM +0200, Peter Zijlstra wrote:
> On Mon, 2010-08-30 at 14:27 +0100, Matt Fleming wrote:
>
> > I'm lost. Is it possible to do this patch entirely in userspace? How do
> > we periodically sample the counters if it's not being done in the
> > kernel?
>
> perf_event_attr leader = {
> .type = PERF_TYPE_SOFTWARE,
> .config = PERF_COUNT_SW_TASK_CLOCK,
> .sample_period = xxx,
> .sample_type = PERF_SAMPLE_READ|...,
> .read_format = PERF_FORMAT_GROUP,
> };
>
> perf_event_attr counter = {
> .type = PERF_TYPE_HARDWARE,
> .config = PERF_COUNT_HW_CPU_CYCLES,
> };
>
> leader_fd = sys_perf_event_open(&leader, pid, cpu, 0, 0);
> counter_fd = sys_perf_event_open(&counter, pid, cpu, leader_fd, 0);
>
> Which gives you a group of 2 events, one software timer that samples,
> one hardware counter that only counts.

Aha. OK, thanks! I'll respin this.


\
 
 \ /
  Last update: 2010-08-30 21:39    [W:1.142 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site