perf/core: Rewrite event timekeeping
commit0d3d73aac2ff05c78387aa9dcc2c8aa3804405e7
authorPeter Zijlstra <peterz@infradead.org>
Tue, 5 Sep 2017 12:16:28 +0000 (5 14:16 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 27 Oct 2017 08:31:59 +0000 (27 10:31 +0200)
tree829a0fcdecec3ba45aac39380fdc8e31acfc286a
parent0c1cbc18df9e38182a0604b15535699c84d7342a
perf/core: Rewrite event timekeeping

The current even timekeeping, which computes enabled and running
times, uses 3 distinct timestamps to reflect the various event states:
OFF (stopped), INACTIVE (enabled) and ACTIVE (running).

Furthermore, the update rules are such that even INACTIVE events need
their timestamps updated. This is undesirable because we'd like to not
touch INACTIVE events if at all possible, this makes event scheduling
(much) more expensive than needed.

Rewrite the timekeeping to directly use event->state, this greatly
simplifies the code and results in only having to update things when
we change state, or an up-to-date value is requested (read).

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/perf_event.h
kernel/events/core.c