Max CPU Usage
Moderators: JRL, Dorian (MJT support)
Max CPU Usage
I have a customer with critical apps running which I have created with MacroScheduler 7.4.
One program runs for 1st thru the 59th minute of each hour, this program calls 3 or 4 other programs based on what it finds in an Access database. We are having to stop/restart several times each day.
The PC has a gig of memory, plenty of processor.
Any ideas? they are close to pulling MacroScheduler from their system.
One program runs for 1st thru the 59th minute of each hour, this program calls 3 or 4 other programs based on what it finds in an Access database. We are having to stop/restart several times each day.
The PC has a gig of memory, plenty of processor.
Any ideas? they are close to pulling MacroScheduler from their system.
Is CPU usage the problem?
If yes then look for a loop running wild. A small wait... something like Wait>0.01 in an otherwise untethered loop can cut CPU usage from 90% down to 2%
See:
http://www.mjtnet.com/forum/viewtopic.p ... t=cpu+loop
Or.. Is it the database that's causing the problem. Access queries will usually prevent me from doing anything else on my computer while they're running. I have 2 gig of RAM.
Later,
Dick
If yes then look for a loop running wild. A small wait... something like Wait>0.01 in an otherwise untethered loop can cut CPU usage from 90% down to 2%
See:
http://www.mjtnet.com/forum/viewtopic.p ... t=cpu+loop
Or.. Is it the database that's causing the problem. Access queries will usually prevent me from doing anything else on my computer while they're running. I have 2 gig of RAM.
Later,
Dick
I'm certain I do not have a tight loop running. Could it be that I am not correctly closing an ODBC connection to Access? The program also does a RetrievePOP3 every few seconds. Is that a potential problem? I have found that one of my programs requires that I break it up into 2 programs so it doesn't lock up during the day.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Not closing an ODBC connection, or freeing activex objects may cause memory leaks, but are unlikely to result in increased CPU utilisation. Are you sure the problem is CPU utilisation, not memory usage?`
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
I would not venture to say I am "sure" of much in this case. I can monitor the CPU usage in TaskMgr and see that it hits 100% from time to time. Each time I open an ODBC to Access I run a sub called DBclose....I never call an activex component....
I have a recurring clue. Everytime the I.S. mgr is out, the programs run perfectly. My question now is "what could she possibly be doing to cause the system to stop 'many times' each day?"
paul
I have a recurring clue. Everytime the I.S. mgr is out, the programs run perfectly. My question now is "what could she possibly be doing to cause the system to stop 'many times' each day?"
paul
I may have solved this one, can't be sure. What I may have found is that my "greed for speed" is very expensive in terms of CPU cycles! Once I recorded the CPU Usage, (thank you Marcus) I noticed there were times in the script (not only the GUI intensive times) which I never pause the script. I added a one second WAIT> in a few places, slowed my scritpt to use wait>.25 instead of wait>.1 in a few places where CPU usage seemed higher, and VOILA!
My customer hasn't called in several days! The real rub is that I was the only one concerned with speed. My customer could not care less if the entry takes 11 seconds per transaction or 20 seconds per....as long as it goes in without issues....
How successful could I be if I could get out of my own way?
My customer hasn't called in several days! The real rub is that I was the only one concerned with speed. My customer could not care less if the entry takes 11 seconds per transaction or 20 seconds per....as long as it goes in without issues....
How successful could I be if I could get out of my own way?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Glad you sussed it. Yeh, tight waits will max out the CPU. I suppose we could modify the code to force a small delay internally after each step, or whenever the code branches. But I'd prefer to leave it to the user to decide when to force Waits and for how long. Hmmm. Food for thought.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
If there's a vote on that, I'd vote to keep the functions working as they are but to add examples of well placed wait>s in the help files.
For example, plagiarized from help:
Non-Modal Dialog Example
Dialog>Dialog1
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,1%CRLF%2
Edit=msEdit2,104,56,121,
EndDialog>Dialog1
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=5,Update
if>r=6,Close
if>r=2,exit
Wait>0.01
Goto>ActionLoop
Label>exit
SRT>Update
Let>Dialog1.msEdit2=%Dialog1.msEdit1% %Dialog1.msComboBox1%
ResetDialogAction>Dialog1
END>Update
SRT>Close
CloseDialog>Dialog1
Let>r=2
END>Close
Later,
Dick
For example, plagiarized from help:
Non-Modal Dialog Example
Dialog>Dialog1
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,1%CRLF%2
Edit=msEdit2,104,56,121,
EndDialog>Dialog1
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=5,Update
if>r=6,Close
if>r=2,exit
Wait>0.01
Goto>ActionLoop
Label>exit
SRT>Update
Let>Dialog1.msEdit2=%Dialog1.msEdit1% %Dialog1.msComboBox1%
ResetDialogAction>Dialog1
END>Update
SRT>Close
CloseDialog>Dialog1
Let>r=2
END>Close
Later,
Dick