#include <stdio.h> 
#include <sys/time.h>
#include <time.h>
int gettimeofday(struct timeval*tv,struct timezone *tz);

int main(int argc, char* argv[])
{ 
   int timeuse; 
   struct timeval starttime,endtime;
   gettimeofday(&starttime,0);
     sleep(2);
   gettimeofday(&endtime,0);  
   timeuse=(endtime.tv_sec-starttime.tv_sec)*1000000+endtime.tv_usec-starttime.tv_usec;
   timeuse/=1000 ;
   printf("the programme run %d second/n the result of 1+2+3+....100 \n ",timeuse);
   printf("Hello World!\n");
    return 0;
}

获取某个程序运行经历的时间差值.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-02-18
  • 2022-12-23
  • 2021-06-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
相关资源
相似解决方案