Move profiler into a macro