JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... スレッドが消費した スレッド毎の CPU 時間を取得する。 下記のシェルのセッションは実行例である。 $ ./a.out Main thread sleeping Subthread starting infinite loop Main thread consuming some CPU time... Process total CPU time: 1.368 Main thread CPU time: 0.376 Su ... n(en, msg) \ do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) static void * thread_start(void *arg) { printf("Subthread starting infinite loop\n"); for (;;) continue; } static void pclock(char *msg, clockid_t cid) { struct timespec ts; printf ... _CPUTIME_ID); */ s = pthread_getcpuclockid(thread, &cid); if (s != 0) handle_error_en(s, "pthread_getcpuclockid"); pclock("Subthread CPU time: 1 ", cid); exit(EXIT_SUCCESS); /* Terminates both threads */ } 関連項目 clock_gettime (2), clock_settime (2), ti ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。