Sign in to follow this  
Followers 0
Insolence

Why does this script use about 5% of the cpu?

6 posts in this topic

http://www.insolence9.com/downloads/iClock.au3

http://www.insolence9.com/downloads/alerts.db

If you want to run the whole thing put the second file in the same dir


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites



My CPU usage bounces between 0% and 4% before running the script, and between 0% and 5% while running the script, but hits 5% only about 1/4 of the time. That's doesn't seem so bad.

System Specs:

XP SP1

P4, 3.06GHz

512MB RAM


Phillip

Share this post


Link to post
Share on other sites

Blah :lmao:

Thanks for testing it.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

it probably wont get better than that, i worked for a few hours trying to make mine take less CPU but i never could get it less than 0-5%


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

Alright, thanks :lmao:


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

use a true "Deep Sleep" :lmao:o:):):)

include the following:

Func _DeepSleep ($timetowait)
; Call system KERNEL32's Sleep, $timetowait SEC
    local $timetowait_ms                    ; for conversion
    $timetowait_ms=$timetowait*1000; adjust to MS
    DllCall("KERNEL32.DLL","none","Sleep","int",$timetowait_ms)
EndFunc

just change your Sleep(10) statement with

if WinActive("iClock") then
        Sleep(10); to ensure "normal" GUI operations are not too sloowwww 
   Else
        _DeepSleep(10); wait before testing next "timer" here 10s (could be set hiher see comment below)
   EndIf

CPU using origial coding: 5 to 6% :whistle:

CPU using _DeepSleep: almost "nothing" :huh2: (except during GUI operations)

obviously depend on the time resolution set

timer parameters resolution should be set higher than "timetowait" not to miss them

Only Drawback: "WINDOWS+C" and "Tray Icon CLICK" should wait at least "1 timetowait" long (but y're nat changing alarm every seconde :) )

No adverse noticeable effect on other programs running or total CPU load on a W98 system

EDIT> CAUTION if you choose a high value for "timetowait" (say 10th of mn or hours) your script will not receive any message, nor could be interrupted using tray icon all that long!!! (to be stopped process has to be "Killed") so be careful <EDIT

Edited by lupusbalo

Share this post


Link to post
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
Sign in to follow this  
Followers 0