在VMware虚拟机中测试, ubuntu12
struct timeval tpstart,tpend;
int timeuse;
gettimeofday(&tpstart,NULL);
int i;
for (i=0; i<10000; i++)
{
usleep(1);
}
gettimeofday(&tpend,NULL);
timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+tpend.tv_usec-tpstart.tv_usec;
printf("Used Time:%d\n",timeuse);
printf("按任意键 写进程退出 \r\n");
getchar();
usleep(1) 4622980 微秒
usleep(10) 5337121 微秒
usleep(100) 6358678 微秒
usleep(200) 6230357 微秒
usleep(1000) 15031617 微秒