Update profiler to abstract the core class along with a slew of optimizations.

Signed-off-by: Peter Chester <peter@tri.be>