diff options
author | Shaohua Li <shli@fb.com> | 2015-02-05 18:55:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-02-18 11:01:44 -0500 |
commit | 72f669c0086fbbbbebc92ce7390125722c4c0ec5 (patch) | |
tree | 358bc05b192b80c896fc603366532cc1cebc0534 /kernel | |
parent | 8e57c586c6a8333c266a6cf76d50e110f2954558 (diff) |
perf: Update shadow timestamp before add event
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 13209a90b751..e580e0f41ac6 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1881,6 +1881,10 @@ event_sched_in(struct perf_event *event, | |||
1881 | 1881 | ||
1882 | perf_pmu_disable(event->pmu); | 1882 | perf_pmu_disable(event->pmu); |
1883 | 1883 | ||
1884 | event->tstamp_running += tstamp - event->tstamp_stopped; | ||
1885 | |||
1886 | perf_set_shadow_time(event, ctx, tstamp); | ||
1887 | |||
1884 | if (event->pmu->add(event, PERF_EF_START)) { | 1888 | if (event->pmu->add(event, PERF_EF_START)) { |
1885 | event->state = PERF_EVENT_STATE_INACTIVE; | 1889 | event->state = PERF_EVENT_STATE_INACTIVE; |
1886 | event->oncpu = -1; | 1890 | event->oncpu = -1; |
@@ -1888,10 +1892,6 @@ event_sched_in(struct perf_event *event, | |||
1888 | goto out; | 1892 | goto out; |
1889 | } | 1893 | } |
1890 | 1894 | ||
1891 | event->tstamp_running += tstamp - event->tstamp_stopped; | ||
1892 | |||
1893 | perf_set_shadow_time(event, ctx, tstamp); | ||
1894 | |||
1895 | if (!is_software_event(event)) | 1895 | if (!is_software_event(event)) |
1896 | cpuctx->active_oncpu++; | 1896 | cpuctx->active_oncpu++; |
1897 | if (!ctx->nr_active++) | 1897 | if (!ctx->nr_active++) |