fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int main() {
  5. clock_t start, end;
  6. double cpu_time_used;
  7.  
  8. start = clock();
  9. // 执行一些操作
  10. for(int i = 0; i < 10000000; i++) {
  11. // 示例操作
  12. }
  13. end = clock();
  14. cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
  15.  
  16. printf("Time used: %f seconds\n", cpu_time_used);
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Time used: 0.000000 seconds