Results 1 to 3 of 3

Thread: A Stop WAtch

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    A Stop WAtch

    Hi!

    I am developing an application in asp.net with c# as the codebehind. I have to determine, how long (time) did it take for a particular piece of code to execute. How to achieve this?
    Thanks.

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: A Stop WAtch

    Well, not sure if this is what you want

    am posting in VB.NET

    Code:
    Private Function DoSomething()
    dim dtStartTime as date = now
    dim i as integer
    
    For i = 0 to 100000
    'Do something here
    Next
    dim dtEndTime as date = now
    'The difference bewteen the end time and start time would tell you how much time it took your code to execute.
    
    
    
    ENd Function

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Re: A Stop WAtch

    Thanks a ton.

    I want to make a class of this, so that it can be used anywhere by creating an instance of it and calling its function.

    Now, shall I have two properties for starttime and endtime and one function to calculate the difference.

    Can you just give me a sample code. I am a newbie as my background was vb/asp..and I have to jump to the .net world.
    Thanks.

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