Move perf functions into its own module