Federico,
I normally use QueryPerformanc eCounter as its in the units used by
Performance Counters:
Something like:
Declare Function QueryPerformanc eCounter Lib "Kernel32" (ByRef counter
As Long) As Boolean
Declare Function QueryPerformanc eFrequency Lib "Kernel32" (ByRef
frequency As Long) As Boolean
' set some time var
Dim start, finish, frequency As Long
QueryPerformanc eFrequency(freq uency)
QueryPerformanc eCounter(start)
' work
QueryPerformanc eCounter(finish )
Dim time As TimeSpan = TimeSpan.FromSe conds((finish - start) /
frequency)
Alternatively you can use DateTime:
' set some time var
Dim start, finish As DateTime
start = DateTime.Now
' work
finish = DateTime.Now
Dim time As TimeSpan = finish.Subtract (start)
A third alternative would be to use "Ticks"
' set some time var
Dim start, finish As Integer
start = Environment.Tic kCount
' work
' set second time var and comapre to get result
finish = Environment.Tic kCount
Dim time As TimeSpan = TimeSpan.FromMi lliseconds(fini sh - start)
My understanding is that QueryPerformanc eCounter will normally be a higher
resolution then Environment.Tic kCount, however QueryPerformanc eCounter may
not be available.
VB.NET 2005 (aka Whidbey, due out later in 2005) simplifies the choice by
providing a System.Diagnost ics.Stopwatch class that will automatically
choose between QueryPerformanc eCounter & Environment.Tic kCount...
http://lab.msdn.microsoft.com/vs2005/ http://msdn2.microsoft.com/library/ebf7z0sw.aspx
Hope this helps
Jay
"Federico G. Babelis" <fe******@gazum .com> wrote in message
news:et******** ******@TK2MSFTN GP10.phx.gbl...
Hi All:
I need to gather the runtime in format "HH:mm:ss" of certain processes
from
its start to its end, any ideas ?
thanks,
Federico