profiler code based on gettimeoffay