forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CPU Usage in Loops (and some STATUS info)...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jul 30, 2002 5:30 pm    Post subject: CPU Usage in Loops (and some STATUS info)... Reply with quote

Thought this was kinda important...

CPU Usage
If you use a continous loop without a WAIT, CPU
usage goes to 100%.

Even a tiny WAIT ".01" drops CPU usage to almost
nothing. Check CPU usage while running this example.

STATUS Element
The help file states that only one STATUS element
may be added to dialogs. This is NOT correct.

I included multiple STATUS elements in the example
(notice that they're added from the bottom up).

Tested with Sysmon.exe (to check CPU usage),
VDS 3.5, and Windows 95.
______________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Test CPU Usage",-1,0,200,90
  DIALOG ADD,BUTTON,Wait,5,5,60,20
  DIALOG ADD,BUTTON,NoWait,5,70,60,20
  DIALOG ADD,BUTTON,Stop,5,135,60,20
  DIALOG ADD,STATUS,Stat1
  DIALOG ADD,STATUS,Stat2
  DIALOG ADD,STATUS,Stat3
DIALOG SHOW

:StopBUTTON
:EVLOOP
  DIALOG SET, Stat1, "Stat1 - Ready..."
  DIALOG SET, Stat2, "Stat2 - Ready..."
  DIALOG SET, Stat3, "Stat3 - Loop not running..."
  WAIT EVENT
  goto @event()

:WaitBUTTON
  DIALOG SET, Stat1, "Stat1 - Loop running using WAIT "@chr(34).01@chr(34)
  DIALOG SET, Stat2, "Stat2 - Ready..."
  DIALOG SET, Stat3, "Stat3 - Ready..."
  REPEAT
    WAIT ".01"
    %e = @event()
  UNTIL %e
  goto %e

:NoWaitBUTTON
  DIALOG SET, Stat1, "Stat1 - Ready..."
  DIALOG SET, Stat2, "Stat2 - Loop running without WAIT"
  DIALOG SET, Stat3, "Stat3 - Ready..."
  REPEAT
    %e = @event()
  UNTIL %e
  goto %e

:CLOSE
  EXIT

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Jul 30, 2002 8:28 pm    Post subject: Re: CPU Usage in Loops (and some STATUS info)... Reply with quote

Mac wrote:
Thought this was kinda important...

CPU Usage
If you use a continous loop without a WAIT, CPU
usage goes to 100%.

Even a tiny WAIT ".01" drops CPU usage to almost
nothing.


Hey Mac

Yeah, this is really important. I noticed it some months ago, and now I have WAIT commands
of various length in all my :evloop sections etc. It just did not cross my mind to put this info on
the board Embarassed


Mac wrote:

STATUS Element
The help file states that only one STATUS element
may be added to dialogs. This is NOT correct.

I included multiple STATUS elements in the example


Ahaa, this might come in handy. And yet another time this shows ya that one shouldn't always
just rely that the documentation is 100% correct - often playing around with things may bring
about interesting stuff.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Wed Jul 31, 2002 1:13 pm    Post subject: Reply with quote

Hi Mac,
I ran into this (CPU usage) a while back and ended up with the same conclusion.
Unfortunately, I didn't notice until NT/2000 users started
complaining Embarassed . It is certainly a good piece of information.

I didn't know about the multiple status elements, pretty cool. Thanks!


moke
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Jul 31, 2002 1:26 pm    Post subject: Reply with quote

You can even have a status-bar on top of the window!!!
If that isn't strange... Smile

Code:

  DIALOG CREATE,New Dialog,-1,0,240,160
  DIALOG ADD,STATUS,STATUS1,STATUS1
  DIALOG ADD,BUTTON,BUTTON1,102,56,,,BUTTON1
  DIALOG SHOW

:evloop
wait event
goto @event()
 
:button1button
dialog hide,status1
dialog show,status1
window position,New Dialog,,,240,160
goto evloop

 
:Close
exit


Looks like an gray EDITBOX... Smile
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Jul 31, 2002 1:58 pm    Post subject: Reply with quote

You can put progress bars in the status elements like in an example of a tree-list that Mac made...but I can't remember where it is...
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Jul 31, 2002 10:34 pm    Post subject: Reply with quote

Most VDS elements in the same location are "stacked" as they
are added - just add the progress bar (DIALOG ADD) after the
status bar.

If an element won't show on top of another one, try adding a
group (same size as the top element), then put the top element
in the group. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group