|
-
Oct 29th, 2006, 09:30 AM
#1
Thread Starter
Frenzied Member
[2005] best way to measure time?
Hi!
I am about to build my very first Winforms application. I have a lot of experience in ASP 2.0. And I'm curious which is the best way to measure the time it takes to complete different operstions, like render the mainform and all child controls, database operations etc etc... In asp.net I have the handy trace tool. But how do I do this in a generic fashion in vs2005 winforms?
/Henrik
-
Oct 29th, 2006, 09:42 AM
#2
Lively Member
Re: [2005] best way to measure time?
VB Code:
Dim seconds as integer
Dim minutes as Integer
Dim hours as integer
Private Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer1.Tick
seconds = seconds + 1
If seconds = 60 Then
minutes = minutes + 1
seconds = 0
If minutes = 60 Then
hours = hours + 1
End If
End If
Label1.Text = hours & ":" & minutes & ":" & seconds
Just make a timer, and set the interval to 1000. Also enable it at the start of your program, if need be.
-
Oct 29th, 2006, 10:20 AM
#3
Re: [2005] best way to measure time?
Do a search on the net, there are lots of posts about monitoring application performance. You may want to look into using performance counters:
http://msdn2.microsoft.com/en-US/library/w8f5kw2e.aspx
I don't think using a timer would really give you what you are looking for.
-
Oct 29th, 2006, 10:42 AM
#4
Re: [2005] best way to measure time?
Well I am not too sure what the 2005 Express versions have, but in the full Team Suite version you have options under Tools to add a Performance Session, which then allows you to do several things in order to evaluate how your app is performing...
http://msdn.microsoft.com/vstudio/te..._profiler.aspx
Lots of other performance analysis tools come with it was well, but I don't believe you would get any of this in the basic Express versions.
If you're just wanting to measure time between operations, then its just a matter of setting a start time and end time in between the code you wish to time, and then subtract the two to get a timespan result of the difference.
Last edited by gigemboy; Oct 29th, 2006 at 10:51 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|