linux内核计算时间差

bool BTime=0;
int tmp;
struct timeval stime,etime;
if(BTime == 0)
{
	do_gettimeofday(&stime);
	BTime = 1;
}
			
XXXXXXXXXXX						

if(wc->BTime == 1)
{
	do_gettimeofday(&etime);
	tmp = (etime.tv_sec - stime.tv_sec)*1000000 + (etime.tv_usec - stime.tv_usec);  //tmp即为时间差
	BTime = 0;
}
printk(" Timer is %d us\n",tmp);




你可能感兴趣的:(timer,linux内核)