Board index » delphi » My application is a resource hog

My application is a resource hog


2006-05-08 10:52:56 PM
delphi262
My application runs at 80% and 100% cpu even when apparently nothing should
be happening. How can I trace what components are causing this. I use a
number of third party tools. including TMS,indy,C4D, Raise.
Will appreciate any help
Thanks
 
 

Re:My application is a resource hog

Billy writes:
Quote
My application runs at 80% and 100% cpu even when apparently nothing
should be happening. How can I trace what components are causing
this. I use a number of third party tools. including TMS,indy,C4D,
Raise.
Are you using threads? I don't know that you can specifically blame
this on a 3rd party component.
--
-Mike (TeamB)
 

Re:My application is a resource hog

"Billy" wrote
Quote
My application runs at 80% and 100% cpu even when apparently
nothing should be happening. How can I trace what components
are causing this.
When running your program under the IDE, to see what part is
executing, just click on the IDE's Pause button and see where it
stops. --JohnH
 

Re:My application is a resource hog

Hello Billy,
It is very difficult to trouble shoot this remotely - but I think the
other posters are right about the threads.
We had a very similar problem with an app we wrote for a client. We had
performance issues when we ran over 20+ instances on a terminal server.
The server would go from 20% CPU to 100% by adding one more instance.
The issue turned out to be one of the suites of components from a
vendor. They had lots of timers firing off on other threads - and after
so many instances - each of which used 100's of their components - it
just crippled the machine. We have simply elarged the duration of the
timers - and now the vendor has dealt with it in their own code.
So - when you are looking for the problem - check out what the
components you are using are doing. You may find that some of them are
firing off timers too often if you are using a large number of the
components in your app.
Good luck.
--
G. Bradley MacDonald
bradley_AT_telus_DOT_net
 

Re:My application is a resource hog

Run it through a profiler. Let it just sit there for a while and then check
which code used up all your cycles.
 

Re:My application is a resource hog

Billy writes:
Quote
My application runs at 80% and 100% cpu even when apparently nothing
should be happening. How can I trace what components are causing
this. I use a number of third party tools. including TMS,indy,C4D,
Raise.
Depends what your app actually does.
Suggestions would be add some debug messages on likely
functions/procedures such as anything that loops round waiting for
anything to happen. Other key things are components refreshing, if you
have something that calls invalidate/refresh without due reason this
can also make your app hog, or very poor performing paint routines.
--
Liz the Brit
Delphi things I have released: www.xcalibur.co.uk/DelphiThings
 

Re:My application is a resource hog

Hi,
Quote
My application runs at 80% and 100% cpu even when apparently nothing should
be happening. How can I trace what components are causing this. I use a
number of third party tools. including TMS,indy,C4D, Raise.
Mabye a Paint, OnPaint or WMPaint procedure.
WMPaint must call inherited and should not cause invalidate.
Julian
 

Re:My application is a resource hog

Billy writes:
Quote
My application runs at 80% and 100% cpu even when apparently nothing
should be happening. How can I trace what components are causing
this. I use a number of third party tools. including TMS,indy,C4D,
Raise.

Will appreciate any help

Thanks
Do you use actions? Do you have an OnUpdate event assigned to them?
Perhaps one (or more) of the OnUpdate events are resource intensive.
--
Compact Framework for Delphi 2006: www.jed-software.com/cf.htm
QualityCentral Windows Client: www.jed-software.com/qc.htm
Visual Forms IDE Add In: www.jed-software.com/vf.htm
 

Re:My application is a resource hog

No don't use threads. I do use the action lists with a number of buttons
that would be enabled disabled based upon certains states. I know Delphi
constantly loops through the actions list for status updates but I am not
sure if it would go upto 100%.
 

Re:My application is a resource hog

I suspect Raize components causing this but it is a wild guess. I have had
problems with some of the components not updating underlaying database and
some other strange behaviour.
 

Re:My application is a resource hog

I do do the invalidates etc but only when some thing changes.
 

Re:My application is a resource hog

I did notice the OnUpdate events of the Actions firing alot. Is there a way
to slow them down or what would be the alternative. Thare are atleast 20
action items that get their status chcked.
 

Re:My application is a resource hog

Billy writes:
Quote
I do do the invalidates etc but only when some thing changes.
Id deffinately run a profiler on it, or add debug so it dumps a time
stamp per routine so you can see it start and leave (all a profiler
does really after all) and see what gets called a lot, what time is
taken etc.
--
Liz the Brit
Delphi things I have released: www.xcalibur.co.uk/DelphiThings
 

Re:My application is a resource hog

Make sure you have the latest version of Raize - there was an early
version of 4 which (IIRC) had a high resource usage in exceptional
situations.
/Matthew Jones/
 

Re:My application is a resource hog

Hello Billy,
Quote
No don't use threads. I do use the action lists with a number of buttons
that would be enabled disabled based upon certains states. I know Delphi
constantly loops through the actions list for status updates but I am not
sure if it would go upto 100%.
It's easy to get to 100% CPU with action lists if you insert forms in other forms.
There's a VCL bug that causes this. If you have forms created inside other
forms (either docked or by setting the Parent property) let me know and I'll
see if I can dig up the code that fixes this.
Gerrit Beuze
ModelMaker Tools