diff options
-rw-r--r-- | kernel/perf_event.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 0b0d5f72fe7d..0aafe85362fd 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -274,7 +274,12 @@ static void update_event_times(struct perf_event *event) | |||
274 | event->group_leader->state < PERF_EVENT_STATE_INACTIVE) | 274 | event->group_leader->state < PERF_EVENT_STATE_INACTIVE) |
275 | return; | 275 | return; |
276 | 276 | ||
277 | event->total_time_enabled = ctx->time - event->tstamp_enabled; | 277 | if (ctx->is_active) |
278 | run_end = ctx->time; | ||
279 | else | ||
280 | run_end = event->tstamp_stopped; | ||
281 | |||
282 | event->total_time_enabled = run_end - event->tstamp_enabled; | ||
278 | 283 | ||
279 | if (event->state == PERF_EVENT_STATE_INACTIVE) | 284 | if (event->state == PERF_EVENT_STATE_INACTIVE) |
280 | run_end = event->tstamp_stopped; | 285 | run_end = event->tstamp_stopped; |