Skip to content

Commit

Permalink
perf: Update shadow timestamp before add event
Browse files Browse the repository at this point in the history
Update the shadow timestamp before start event, because .add might
use the timestamp.

Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Link: http://lkml.kernel.org/r/9cd0276d6a047cb7c2885994f25e3a1f7c8c28af.1423180257.git.shli@fb.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Shaohua Li authored and Ingo Molnar committed Feb 18, 2015
1 parent 8e57c58 commit 72f669c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,17 +1881,17 @@ event_sched_in(struct perf_event *event,

perf_pmu_disable(event->pmu);

event->tstamp_running += tstamp - event->tstamp_stopped;

perf_set_shadow_time(event, ctx, tstamp);

if (event->pmu->add(event, PERF_EF_START)) {
event->state = PERF_EVENT_STATE_INACTIVE;
event->oncpu = -1;
ret = -EAGAIN;
goto out;
}

event->tstamp_running += tstamp - event->tstamp_stopped;

perf_set_shadow_time(event, ctx, tstamp);

if (!is_software_event(event))
cpuctx->active_oncpu++;
if (!ctx->nr_active++)
Expand Down

0 comments on commit 72f669c

Please sign in to comment.