Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因此,我想获取给定 ID 的线程使用的 cpu 时间。getrusage在这里不适用,因为getrusage(RUSAGE_THREAD, &r_usage);返回调用它的线程使用的资源,在这里我想获取一个线程的资源,而不是我所在的线程。
getrusage
getrusage(RUSAGE_THREAD, &r_usage);