event/sw: move stats code for better cache access