Jump to content

How Do I Reduce Cpu Cycles


Guest Spike
 Share

Recommended Posts

Guest Spike

Greetings from Downunder,

I've just written this poor man's cookie cruncher for Opera 7.23

It works ok but uses 100% cpu cycles.

Any suggestion for recoding to reduce cpu cycles ??????

TIA

Spike

here is the code

Global $Paused

HotKeySet("{F10}", "Terminate"); example F10 to exit

$title=0

while $title=0

$title=winactive("The server wishes to send you a cookie")

if $title=1 then

;MsgBox(0, "Value =","cookie time")

;sleep(1000)

winkill("The server wishes to send you a cookie")

$title=0

endif

wend

Func Terminate()

Exit 0

EndFunc

Link to comment
Share on other sites

Greetings from Downunder,

I've just written this poor man's cookie cruncher for Opera 7.23

It works ok but uses 100% cpu cycles.

Any suggestion for recoding to reduce cpu cycles ??????

TIA

Spike

here is the code

Global $Paused

HotKeySet("{F10}", "Terminate"); example F10 to exit

$title=0

while  $title=0

$title=winactive("The server wishes to send you a cookie")

if $title=1 then

;MsgBox(0, "Value =","cookie time")

;sleep(1000)

winkill("The server wishes to send you a cookie")

$title=0

endif

wend

Func Terminate()

  Exit 0

EndFunc

Put Sleep(100) in at the beginning or the ending of your loop. :whistle:

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Link to comment
Share on other sites

AutoIt runs balls out. Even though it was doing nothing, it was doing it very very fast and thus, using up cycles. By telling it to Sleep for 100 ms, you are literally telling it to slow down and pause for 100 ms between times the loop executes.

Link to comment
Share on other sites

Guest Spike

Thanks Valik,

I sort of came to that answer myself after i sat down

and thought about it for a while!

Thanks for the help everybody.

Spike

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...