以一般+便携方式测量运行时间 [英] Measuring running time in a general + portable way

查看:66
本文介绍了以一般+便携方式测量运行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正试图找到一种衡量长期运行的长期计划运行时间的好方法。

比如说,运行时间从几秒到一天以上。


标准的clock()函数似乎不适合这项任务。

(我在这个组中的某个地方读到clock_t可能会在<1小时后溢出

)。


有没有更好的解决方案可以处理这可以携带吗?

谢谢。

Hi,

I''m trying to find a decent way of measuring the running time of a
long-running program.
Say, the running time ranges from several seconds to more than a day.

The standard clock() function seems inadequate for this task.
(I read somewhere in this group that clock_t would likely overflow
after <1 hour).

Is there any better solution that can deal with this and be portable?
Thank you.

推荐答案

2007年4月25日17:52:27 -0700,upperclass< th ******** @ gmail.comwrote:
On 25 Apr 2007 17:52:27 -0700, upperclass <th********@gmail.comwrote:

>

我'我试图找到一种衡量长期运行程序运行时间的好方法。
说,运行时间从几秒钟到一天以上。
标准的clock()函数似乎不适合这项任务。
(我在这个小组的某个地方读过在<1小时后),clock_t可能会溢出。

有没有更好的解决方案可以解决这个问题并且可以移植?
谢谢。
>Hi,

I''m trying to find a decent way of measuring the running time of a
long-running program.
Say, the running time ranges from several seconds to more than a day.

The standard clock() function seems inadequate for this task.
(I read somewhere in this group that clock_t would likely overflow
after <1 hour).

Is there any better solution that can deal with this and be portable?
Thank you.



IIANM,difftime可以为你提供两个时钟之间的差异。

时钟时间。见time.h.如果你有posix(广泛使用)你可以比b / b更精细的分辨率。

IIANM, difftime will portably give you the difference between two wall
clock times. See time.h. If you have posix (widely available) you can
a finer resolution than seconds.


Richard Harter写道:
Richard Harter wrote:

>

NNTP-Posting-Date:Wed,2007年4月25日20:22:21 -0500
>
NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500



您的时钟出现严重错误。


-

< http://www.cs.auckland.ac.nz /~pgut001/pubs/vista_cost.txt>

< http://www.securityfocus.com/columnists/423>

< http:// www。 aaxnet.com/editor/edit043.html>

cbfalconer at maineline.net


-

通过免费的Usenet发布来自 http://www.teranews.com 的帐户

Your clock is in serious error.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline.net

--
Posted via a free Usenet account from http://www.teranews.com


2007年4月26日星期四00:25:27 -0400,CBFalconer< cb ******** @ yahoo.com>

写道:
On Thu, 26 Apr 2007 00:25:27 -0400, CBFalconer <cb********@yahoo.com>
wrote:

> Richard Harter写道:
>Richard Harter wrote:

>>
NNTP-Posting-Date:Wed,2007年4月25日20:22:21 -0500
>>
NNTP-Posting-Date: Wed, 25 Apr 2007 20:22:21 -0500


你的时钟很严重错误。


Your clock is in serious error.



嗯???

Huh???


这篇关于以一般+便携方式测量运行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆