プログラム実行時間/Cの経過時間を計算する
ここで私はプログラムの実行時間やCで経過した時間を計算する簡単な方法を共有
…./
calculate program execute time
/#include
#include
int main(int argc, char ** argv[]) {
time
t start, stop;
clock
t ticks; long count;
time(&start); //Do stuff int i=0;
while(i<50000) { printf("Work work %d\n", i); i++; ticks = clock();
}
time(&stop);
printf("Used %0.2f seconds of CPU time. \n", (double)ticks/CLOCKS__PER__SEC); printf("Finished in about %.0f seconds. \n", difftime(stop, start)); return 0; }
link://tag/c-2/[c]