Results 1 to 4 of 4

Thread: [2005] best way to measure time?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    [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

  2. #2
    Lively Member
    Join Date
    Oct 2006
    Posts
    88

    Re: [2005] best way to measure time?

    VB Code:
    1. Dim seconds as integer
    2. Dim minutes as Integer
    3. Dim hours as integer
    4.  
    5.    Private Sub timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer1.Tick
    6.  
    7.     seconds = seconds + 1
    8.  
    9.        If seconds = 60 Then
    10.             minutes = minutes + 1
    11.             seconds = 0
    12.                If minutes = 60 Then
    13.                    hours = hours + 1
    14.                End If
    15.        End If
    16.  
    17.         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.

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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.

  4. #4
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    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
  •  



Click Here to Expand Forum to Full Width