当前位置:网站首页>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 .
边栏推荐
- Detailed explanation of use scenarios and functions of polar coordinate sector diagram
- How was the middle table destroyed?
- Cs231n notes (bottom) - applicable to 0 Foundation
- 齐宣王典故
- Data access - entityframework integration
- Etcd build a highly available etcd cluster
- [729. My Schedule i]
- BS-XX-042 基于SSM实现人事管理系统
- Clear restore the scene 31 years ago, volcanic engine ultra clear repair beyond classic concert
- PHP人才招聘系统开发 源代码 招聘网站源码二次开发
猜你喜欢

Solution of vant tabbar blocking content
![[61dctf]fm](/img/22/3e4e3f1679a27d8b905684bb709905.png)
[61dctf]fm

【729. 我的日程安排表 I】

【刷题篇】有效的数独

Basic introduction to the control of the row component displaying its children in the horizontal array (tutorial includes source code)

干货!半监督预训练对话模型 SPACE

NPM installation

Games101 notes (I)

Etcd build a highly available etcd cluster

Games101 notes (III)
随机推荐
What is ROM
Is it safe to open a securities account by mobile phone? Detailed steps of how to buy stocks
Global Data Center released DC brain system, enabling intelligent operation and management through science and technology
PHP人才招聘系统开发 源代码 招聘网站源码二次开发
How to uninstall MySQL cleanly
[es6] 模板字符串内添加if判断或添加三元运算符判断
Flet tutorial 12 stack overlapping to build a basic introduction to graphic and text mixing (tutorial includes source code)
干货!半监督预训练对话模型 SPACE
面对新的挑战,成为更好的自己--进击的技术er
【刷题篇】有效的数独
[js] 技巧 简化if 判空
Precision epidemic prevention has a "sharp weapon" | smart core helps digital sentinels escort the resumption of the city
Sentinel flow guard
ECU简介
麻烦问下,DMS中使用Redis语法是以云数据库Redis社区版的命令为参考的嘛
【剑指 Offer】66. 构建乘积数组
【机器人坐标系第一讲】
文件操作--I/O
解决CMakeList find_package找不到Qt5,找不到ECM
[first lecture on robot coordinate system]