Add event counting for numpy based optimisations