Home All Groups Group Topic Archive Search About

How do I measure the time it takes to copy a file?

Author
12 Apr 2005 11:29 AM
Julian Milano
I want to copy a file from one PC to another using DotNet and would like to
time the operation- how do I do it?

Author
12 Apr 2005 11:43 AM
Cor Ligthert
Julian,

>I want to copy a file from one PC to another using DotNet and would like to
>time the operation- how do I do it?

On a 1Gb connection or over a 22Kb dataline?

Cor
Author
12 Apr 2005 11:57 AM
AMercer
do something like this:

    Dim dtMark As DateTime = Now
    ' do your file copy here
    Dim sec As Double = Now.Subtract(dtMark).TotalSeconds
    ' at this point, sec is double precision seconds that the copy took


Show quoteHide quote
"Julian Milano" wrote:

> I want to copy a file from one PC to another using DotNet and would like to
> time the operation- how do I do it?
>
>
>
Author
12 Apr 2005 12:04 PM
Diana Mueller
"Julian Milano" <jdm***@datafast.net.au> schrieb im Newsbeitrag
news:e2X3yL1PFHA.1392@TK2MSFTNGP10.phx.gbl...
> I want to copy a file from one PC to another using DotNet and would like
to
> time the operation- how do I do it?

Well, you would have to implement a copy mechanism that calls a
callbackfunction after every nth part of your file has been copied, so you
could gradually improve the estimate of your completion time (a simple
estimating function would be completion time = start time + (elapsed time /
n) * 100)
Author
12 Apr 2005 1:07 PM
Chris Dunaway
Something like this:

Dim dtStart As DateTime = DateTime.Now

'copy file here

Dim tsElapsed As TimeSpan = DateTime.Now.Subtract(dtStart)

MsgBox("Elapsed time: " & tsElapsed.TotalSeconds.ToString)
Author
12 Apr 2005 2:23 PM
Herfried K. Wagner [MVP]
"Julian Milano" <jdm***@datafast.net.au> schrieb:
>I want to copy a file from one PC to another using DotNet and would like to
>time the operation- how do I do it?

StopWatch
<URL:http://www.mentalis.org/soft/class.qpx?id=8>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>