lkml.org 
[lkml]   [2010]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf_events: improve x86 event scheduling
On Sun, Jan 17, 2010 at 03:42:16PM +0100, Stephane Eranian wrote:
> Frederic,
>
>
> Here is what I have now in the x86 code.
>
> As for your comment on disabling the x86 event, we don't
> need to do this because it is not actually activated yet when
> we return from hw_perf_group_sched_in(). Activation occurs
> really in hw_perf_enable().


Ah, indeed.


>
>
> static int x86_event_sched_in(struct perf_event *event,
> struct perf_cpu_context *cpuctx, int cpu)
> {
> int ret = 0;
>
> event->state = PERF_EVENT_STATE_ACTIVE;
> event->oncpu = cpu;
> event->tstamp_running += event->ctx->time - event->tstamp_stopped;
>
> if (is_software_event(event))
> ret = event->pmu->enable(event);
>
> if (!ret && !is_software_event(event))
> cpuctx->active_oncpu++;
>
> if (!ret && event->attr.exclusive)
> cpuctx->exclusive = 1;
>
> return ret;
> }
>
> static void x86_event_sched_out(struct perf_event *event,
> struct perf_cpu_context *cpuctx, int cpu)
> {
> event->state = PERF_EVENT_STATE_INACTIVE;
> event->oncpu = -1;
>
> event->tstamp_running -= event->ctx->time - event->tstamp_stopped;
>
> if (is_software_event(event))
> event->pmu->disable(event);
>
> if (!is_software_event(event))
> cpuctx->active_oncpu--;
>
> if (event->attr.exclusive || !cpuctx->active_oncpu)
> cpuctx->exclusive = 0;
> }



Yeah looks good.

Thanks.



\
 
 \ /
  Last update: 2010-01-17 17:21    [W:0.104 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site