当前位置:网站首页>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 .
边栏推荐
- Jarvis OJ Webshell分析
- 关于new Map( )还有哪些是你不知道的
- How to uninstall MySQL cleanly
- Is it safe to open a securities account by mobile phone? Detailed steps of how to buy stocks
- Deep learning plus
- Spring Festival Limited "forget trouble in the year of the ox" gift bag waiting for you to pick it up~
- [wechat applet] read the life cycle and route jump of the applet
- Benji Banas membership pass holders' second quarter reward activities update list
- Summary of methods for finding intersection of ordered linked list sets
- [Jianzhi offer] 62 The last remaining number in the circle
猜你喜欢
深潜Kotlin协程(二十一):Flow 生命周期函数
干货!半监督预训练对话模型 SPACE
Spring Festival Limited "forget trouble in the year of the ox" gift bag waiting for you to pick it up~
Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
Keras crash Guide
为季前卡牌游戏 MotoGP Ignition Champions 做好准备!
Copy mode DMA
Jarvis OJ Webshell分析
How does win11 change icons for applications? Win11 method of changing icons for applications
高数 | 旋转体体积计算方法汇总、二重积分计算旋转体体积
随机推荐
[729. My schedule I]
Domestic API management artifact used by the company
Cs231n notes (bottom) - applicable to 0 Foundation
"21 days proficient in typescript-3" - install and build a typescript development environment md
Get ready for the pre-season card game MotoGP ignition champions!
【刷題篇】鹅廠文化衫問題
Timestamp strtotime the day before or after the date
【剑指 Offer】66. 构建乘积数组
网站页面禁止复制内容 JS代码
Bs-xx-042 implementation of personnel management system based on SSM
Clear restore the scene 31 years ago, volcanic engine ultra clear repair beyond classic concert
ECU introduction
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
Precision epidemic prevention has a "sharp weapon" | smart core helps digital sentinels escort the resumption of the city
[61dctf]fm
[Jianzhi offer] 66 Build product array
Solution of vant tabbar blocking content
Apple has abandoned navigationview and used navigationstack and navigationsplitview to implement swiftui navigation
Etcd build a highly available etcd cluster
SQL injection of cisp-pte (Application of secondary injection)