gettimeofday

페이지 정보

작성자 조희승 댓글 0건 조회 4,452회 작성일 16-04-27 11:02

본문

#include <sys/time.h>
#define trace(x...) fprintf(stderr, "[%s:%d] ", __func__, __LINE__); fprintf(stderr, x); fprintf(stderr, "\n");
struct timeval t1, t2; double d1, d2;
gettimeofday(&t1, NULL); d1=t1.tv_sec + t1.tv_usec*0.000001;
gettimeofday(&t2, NULL); d2=t2.tv_sec + t2.tv_usec*0.000001;
printf("Elasedtime %.6f \n", d2 - d1);
trace("Elasedtime %.6f \n", d2 - d1);






커널에선
include 없이 do_gettimeofday($t1). %f안찍힘

#define tr(x...) printk("[%s:%d] ", __func__, __LINE__); printk(x); printk("\n");
tr("%lu", (t2.tv_sec*1000000 + t2.tv_usec) - (t1.tv_sec*1000000 + t1.tv_usec) );

댓글목록

등록된 댓글이 없습니다.