Move profiling code from platform to commons