简体   繁体   English

测量经过时间

[英]Measuring elapsed time

I added following code to measure to learn how many milliseconds program lasted. 我添加了以下代码来测量以了解程序持续了多少毫秒。 The problem is I get 1065 Clocks and 1065 Milli seconds. 问题是我得到1065时钟和1065毫秒。 Is it normal that they are equal? 他们平等是正常的吗? Maybe my equation is wrong which converts clock into milliseconds? 也许我的方程式是错误的,它将时钟转换为毫秒? Thanks in advance 提前致谢

finishClock = clock();
timeCount = finishClock - startClock ;
printf("Clocks passed: %f\n Milli Seconds passed: %f",timeCount, timeCount*1000/CLOCKS_PER_SEC);

Based on the Tcl References here , they are synonymous: 基于此处Tcl References ,它们是同义词:

If the -option argument is -milliseconds, then the command is synonymous with clock milliseconds (see below). 如果-option参数为-milliseconds,则该命令与时钟毫秒同义(请参见下文)。 This usage is obsolete, and clock milliseconds is to be considered the preferred way of obtaining a count of milliseconds. 这种用法已经过时了,时钟毫秒被认为是获得毫秒计数的首选方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM