#include <sys/time.h>

struct timeval tpstart,tpend;     float timeuse;     gettimeofday(&tpstart,NULL); // 开始时间

 packet();  //usleep(1);//微秒  //sleep(1);//秒  //uppacket();

 gettimeofday(&tpend,NULL);   // 结束时间  // 计算执行时间,以微秒为单位进行计算       timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+tpend.tv_usec-tpstart.tv_usec;       timeuse/=1000000;       printf("used time:%f sec\n",timeuse);

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-12
  • 2022-12-23
  • 2021-05-26
  • 2021-11-30
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
相关资源
相似解决方案