changed profiler to use register_tick_function