Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Timer Events

Timer Events

Scheduled Pinned Locked Moved Visual Basic
question
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V 2
    wrote on last edited by
    #1

    Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O

    Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

    M M 2 Replies Last reply
    0
    • V V 2

      Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O

      Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

      M Offline
      M Offline
      MarkB777
      wrote on last edited by
      #2

      How fast is your processor? Does it work if you set it, to say, 5ms delay?

      Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

      V 1 Reply Last reply
      0
      • M MarkB777

        How fast is your processor? Does it work if you set it, to say, 5ms delay?

        Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

        V Offline
        V Offline
        V 2
        wrote on last edited by
        #3

        My processor speed is 2.0 GHz and Ram Speed is 1 GB Can u give the reason why it is happening??? Thanks 4 ur reply :-O

        Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

        M 1 Reply Last reply
        0
        • V V 2

          My processor speed is 2.0 GHz and Ram Speed is 1 GB Can u give the reason why it is happening??? Thanks 4 ur reply :-O

          Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

          M Offline
          M Offline
          MarkB777
          wrote on last edited by
          #4

          Did you try running it with the timer inverval a bit higher?

          Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

          V 1 Reply Last reply
          0
          • M MarkB777

            Did you try running it with the timer inverval a bit higher?

            Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

            V Offline
            V Offline
            V 2
            wrote on last edited by
            #5

            I set 5 ms the intervel so it fired only 63 times in 1 Seconds In 1 Seconds Intervell(ms)->Fired (Data) 5->63 50->15 100->9 times fired

            Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

            M 1 Reply Last reply
            0
            • V V 2

              I set 5 ms the intervel so it fired only 63 times in 1 Seconds In 1 Seconds Intervell(ms)->Fired (Data) 5->63 50->15 100->9 times fired

              Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

              M Offline
              M Offline
              MarkB777
              wrote on last edited by
              #6

              Although it dosent make sense to me (as your computer is not that slow) I do find it odd that at the lower intervals (i.e 5) the amount of fired events is way off target, but at higher intervals (i.e 100) it is close to its target. There has to be something, somewhere, that is slowing down the amount of time it takes to execute the timer tick event. If not, i'm dumbfounded.

              Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

              V 1 Reply Last reply
              0
              • M MarkB777

                Although it dosent make sense to me (as your computer is not that slow) I do find it odd that at the lower intervals (i.e 5) the amount of fired events is way off target, but at higher intervals (i.e 100) it is close to its target. There has to be something, somewhere, that is slowing down the amount of time it takes to execute the timer tick event. If not, i'm dumbfounded.

                Mark Brock "We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen Click here to view my blog

                V Offline
                V Offline
                V 2
                wrote on last edited by
                #7

                Thanks for your time.... Recently i found in my search that The Windows Forms Timer simply isn't that accurate :omg: . I know - we'd think that if it promises you millisecond intervals it could produce the goods, but fact is it doesn't. :confused:

                Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

                D 1 Reply Last reply
                0
                • V V 2

                  Thanks for your time.... Recently i found in my search that The Windows Forms Timer simply isn't that accurate :omg: . I know - we'd think that if it promises you millisecond intervals it could produce the goods, but fact is it doesn't. :confused:

                  Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  Assuming your using the System.Windows.Forms.Timer (in the Toolbox), you simply would have had to read the documentation on it (click on the Timer on your form, then hit F1) to find this: Note: The Windows Forms Timer component is single-threaded, and is limited to an accuracy of 55 milliseconds. If you require a multithreaded timer with greater accuracy, use the Timer class in the System.Timers namespace. In practice, your actual accuracy will vary, depending on system load, application load, and hardware capabilities.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  1 Reply Last reply
                  0
                  • V V 2

                    Hi all :laugh: I have a timer on my form and its intervel is 1 milli sec 1 Seconds =1000 Mili Sec So my timer should be fired 1000 times in 1 Sec but it fires only 60-65 times in 1 sec i have not use lenthy process in it only increase the integer value by 1 each time it fires n check it after 1 sec In Timer event i used only IntValue+=1 After 1 Sec IntValue is reached at 60-65 Can anyone tell me wht is happnening behind it?? Thanks with anticipations :-O

                    Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

                    M Offline
                    M Offline
                    Mark Churchill
                    wrote on last edited by
                    #9

                    I can't remember which way the Win.Forms Timer class works, but I'm pretty certain it marshalls events back onto the UI thread using Form.Invoke. That means you are limited to the speed of the windows message loop, and definitely the scheduling quanta, which is about 50ms. There's another Timer class somewhere, but I doubt that will get down to 1ms accurately. Any other thread that takes up the CPU is going to get a whole 50ms to itself, blocking your stuff.

                    Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
                    Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups