2013-12-04から1日間の記事一覧

clcok_gettime(2)で実時間とかcpu時間を計る

Linuxのclock_gettime(2)を見ると実時間、プロセスのcpu時間、スレッド毎のcpu時間を計測できるらしいので使ってみる。includeするのはtime.h。 #include <unistd.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <assert.h> static inline double timespec2msec(const str</assert.h></pthread.h></stdlib.h></stdio.h></time.h></unistd.h>…