Redo the whole logic for concurrency safety.

Instead of manipulating the timer directly have an event type for
every event we're measuring. The event points to the pre-allocated
timer and updates it on Stop/Handover. The update is done with atomic
operations, but is in itself not safe, so it will potentially show
partially updated data. This is a good tradeoff for speed. The
allocation itself is protected with a mutex.