HOWTO - 测量函数执行 [英] HOWTO - measure a function execution

查看:66
本文介绍了HOWTO - 测量函数执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要测量一个函数执行多长时间......或者

代码序列


-

Ceers,

Crirus


------------------------ ------

如果工作是件好事,老板会把这一切都拿走给你


--------- ---------------------

解决方案

这是一个''CLUNKY''但是如果代码执行时间可能相当准确,那么
时间非常小。


PSEUDO CODE

------ ------------


Dim startTime,EndTime as Time

Dim x as

Const NTIMES = 10,000(取决于执行

函数的时间长度)


startTime =现在

对于x = 1到NTIMES(取决于执行

的时间长短)


通话功能


下一页

EndTime =现在


显示"运行时间function =" &安培; endTime-StartTime(In Seconds)/

NTIMES

OHM


Crirus写道:

I需要测量一个函数执行的时间......或者

中的代码序列


Hi Crirus,


我从Nick(Nak)复制了一次


Dim StartTick As Integer = Environment.TickCount

..... ............

Dim Elapsed As Integer = Environment.TickCount - StartTick


Cor

" Crirus" <铬**** @ datagroup.ro> schrieb

我需要测量函数执行的时间......或者

中的代码序列

你可以使用

Environment.Tickcount

-

Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


I need to measure how long a function take to execute... or a sequence of
code within

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

解决方案

Here is one ''CLUNKY'' but probably fairly accurate way if the code execution
time is very small.

PSEUDO CODE
------------------

Dim startTime, EndTime as Time
Dim x as long
Const NTIMES = 10,000 ( Depending on the length of time to perform the
function )

startTime= Now
For x=1 to NTIMES ( Depending on the length of time to perform the
unction )

Call Function

Next
EndTime= now

Display "Time to run function = " & endTime-StartTime( In Seconds ) /
NTIMES
OHM

Crirus wrote:

I need to measure how long a function take to execute... or a
sequence of code within



Hi Crirus,

This one I copied once from Nick (Nak)

Dim StartTick As Integer = Environment.TickCount
.................
Dim Elapsed As Integer = Environment.TickCount - StartTick

Cor


"Crirus" <Cr****@datagroup.ro> schrieb

I need to measure how long a function take to execute... or a
sequence of code within



You can use
Environment.Tickcount
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


这篇关于HOWTO - 测量函数执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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