+ Reply to Thread
Results 1 to 2 of 2

Time comparison

Hybrid View

  1. #1
    Gixxer_J_97
    Guest

    Time comparison

    Hi all

    I am trying to figure out what section of my code is running the longest.

    how do i compare two times (ie subtract the two so that i can get a total
    time run)

    sub MyCode()
    dim t1, t2, total
    t1=time
    <my code>
    t2=time

    total=<how do i work with the time here>
    msgbox total
    end sub

    is this the correct way to do this or is there a better way?

    and secondly is there a way to write one sub and have it triggered any time
    that code is run, without putting a call to it in each of my functions?

    basically i want to see how long each section of my code takes to run, so i
    can see where the slowdowns are and possibly re-write, etc


    tia!

    J

  2. #2
    sebastienm
    Guest

    RE: Time comparison

    Hi,

    t1=Timer( )
    ....
    t2=Timer( )

    total = t2-t1
    --
    Regards,
    Sébastien


    "Gixxer_J_97" wrote:

    > Hi all
    >
    > I am trying to figure out what section of my code is running the longest.
    >
    > how do i compare two times (ie subtract the two so that i can get a total
    > time run)
    >
    > sub MyCode()
    > dim t1, t2, total
    > t1=time
    > <my code>
    > t2=time
    >
    > total=<how do i work with the time here>
    > msgbox total
    > end sub
    >
    > is this the correct way to do this or is there a better way?
    >
    > and secondly is there a way to write one sub and have it triggered any time
    > that code is run, without putting a call to it in each of my functions?
    >
    > basically i want to see how long each section of my code takes to run, so i
    > can see where the slowdowns are and possibly re-write, etc
    >
    >
    > tia!
    >
    > J


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1