Move profile data writing out of scheduler