473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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?
Nov 21 '05 #1
5 3193
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
Nov 21 '05 #2
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
"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?

Nov 21 '05 #3
"Julian Milano" <jd****@datafast.net.au> schrieb im Newsbeitrag
news:e2**************@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)
Nov 21 '05 #4
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)

Nov 21 '05 #5
"Julian Milano" <jd****@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/>

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

354
15496
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets...
96
3862
by: John Harrison | last post by:
I knew that unsigned integral data types were the cause of scads of mostly spurious warning messages, but I didn't realise that they were a security risk too (see here...
13
1577
by: Chiller | last post by:
I'm now getting close to finishing my Distance class. In the code below I have included a number of overload operators that test for equality etc. I've also added more code in the TEST_DISTANCE...
4
3162
by: Christophe F. [MS] | last post by:
Hello, I'm looking for sample code in C# that will estimate the transfer time for a file between two machines (taking into account bandwidth and latency). -- Regards, CF
3
3850
by: Steve | last post by:
I used the QueryPerformanceCounter and QueryPerformanceFrequency methods in my VC++ 6.0 projects to measure correct time spans, for example for timeouts, how much time takes to execute certain...
4
2198
by: Ravi Ambros Wallau | last post by:
Hi: We developed a set of ASP.NET Web Applications that never runs in stand-alone mode, but always inside a portal (Rainbow Portal). All modules are copied on that portal. My question is: load...
3
3404
by: Neagu, Adrian | last post by:
Hello everybody, I try to solve the following problem: I have a python program that takes a lot of memory (>hundred Mb). I made an improvement (I hope) and I want to measure the gain (if...
4
12830
by: halimunan | last post by:
Hello all, I have a question, how do i measure the download/upload speed... as if download rate, upload rate or kbps transfer rate. i want to do my own windows application using C# to measure the...
1
2747
by: kartouss | last post by:
Hello i am new to this forum...can you help me solve this problem.. I have a function encrypt() which encrypts data from a file in 16 bytes till end of file which in turn calls other 4...
0
7160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.