Move getrusage() out of thread_stat