Jump to content

Sleep Function causing stutter


Recommended Posts

The core piece of my script runs within a While WEnd loop and I have a Sleep(100) command placed in to keep it from eating the processor. The script ran great for 2 months until some automated driver updates were forced down to my laptop from our corporate IT group. Now this sleep function seems to be causing a stutter,most noticeable in mouse movement but also in screen refreshes.

If I comment out the Sleep function the stutter goes away but the CPU utilization for AutoIt jumps from 0-1% to 10-15% so that's not really a viable long-term option.

I'm trying to back out the driver updates that were performed, though it's proving more difficult than first thought so I figured I'd check here in case anyone is familiar with this type of behavior and how to correct it.

Thanks!

Link to comment
Share on other sites

Sounds like a pretty isolated problem. Maybe as a compromise just set the sleep time lower? See if that helps at all, I find a sleep(10) usually helps me out plenty.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

Sounds like a pretty isolated problem. Maybe as a compromise just set the sleep time lower? See if that helps at all, I find a sleep(10) usually helps me out plenty.

As far as I know autoIt includes pauses in loops by default and advises against using sleep to lower CPU load, but does give an OPT command to increase the default sleep time. I'll see if I can find it.

Edit:

From the AutoIt helpfile:

GUI Reference - MessageLoop Mode:

Usually a tight loop like the one shown would send the CPU to 100% - fortunately the GUIGetMsg function automatically idles the CPU when there are no events waiting. Do not put a manual sleep in the loop for fear of stressing the CPU - this will only cause the GUI to become unresponsive.

Not sure if this applies to your script, or how to lower CPU usage without a sleep timer. I guess you can post an example script so someone with a bit more knowledge then me can take a look at it.

Edited by Tvern
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...