当前位置:网站首页>C language to get program running time
C language to get program running time
2022-07-05 17:01:00 【Oh-liuxing】
#include <stdio.h>
#include <time.h>
int main(){
printf("hello word\n");
printf("Time used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}
explain :(1) Timing function clock() Returns the time the program has run so far , In Milliseconds . Call it before the program ends , You can get the running time of the whole program . This time is divided by a constant CLOCKS_PER_SEC The resulting value is expressed in “ second ” In units of .
(2) stay VC++6.0 in time.h Constants defined by the next macro CLOCKS_PER_SEC, Its value is 1000.
#define CLOCKS_PER_SEC 1000
about CLOCKS_PER_SEC, It's used to show how many clock units there are in a second , The length of the clock timing unit is 1 millisecond ,clock()/CLOCKS_PER_SEC Is to convert milliseconds into seconds .
边栏推荐
- Do sqlserver have any requirements for database performance when doing CDC
- Jarvis OJ webshell analysis
- dried food! Semi supervised pre training dialogue model space
- 数据访问 - EntityFramework集成
- Twig数组合并的写法
- File operation --i/o
- Solve cmakelist find_ Package cannot find Qt5, ECM cannot be found
- Application of threshold homomorphic encryption in privacy Computing: Interpretation
- 【 brosser le titre 】 chemise culturelle de l'usine d'oies
- 网站页面禁止复制内容 JS代码
猜你喜欢
Jarvis OJ Flag
Android privacy sandbox developer preview 3: privacy, security and personalized experience
飞桨EasyDL实操范例:工业零件划痕自动识别
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
How to set the WiFi password of the router on the computer
Keras crash Guide
Jarvis OJ Telnet Protocol
File operation --i/o
Jarvis OJ 简单网管协议
dried food! Semi supervised pre training dialogue model space
随机推荐
Jarvis OJ 简单网管协议
American chips are no longer proud, and Chinese chips have successfully won the first place in emerging fields
Can you help me see what the problem is? [ERROR] Could not execute SQL stateme
Facing new challenges and becoming a better self -- attacking technology er
[deep learning] [original] let yolov6-0.1.0 support the txt reading dataset mode of yolov5
网站页面禁止复制内容 JS代码
Games101 notes (II)
Twig数组合并的写法
ECU introduction
What is the difference between EDI license and ICP business license
Application of threshold homomorphic encryption in privacy Computing: Interpretation
Domestic API management artifact used by the company
网上办理期货开户安全吗?网上会不会骗子比较多?感觉不太靠谱?
[Jianzhi offer] 66 Build product array
Solution of vant tabbar blocking content
數據訪問 - EntityFramework集成
[echart] resize lodash to realize chart adaptation when window is zoomed
树莓派4b安装Pytorch1.11
Games101 notes (I)
The survey shows that the failure rate of traditional data security tools in the face of blackmail software attacks is as high as 60%