PDA

View Full Version : How to monitor js process's that causing system overload


frontline
09-04-2003, 08:41 AM
Hello
i have page with some 500+ lines of js-dhtml code
alot of this code is involving creating objects .. now i notice that
when the page in loading the CPU Usage got to 100% and stays there
there is no js error warning of any kind.
my question is how can i monitor the script to know what section of the script
giving me the CPU overload.
thanks

Kor
09-04-2003, 09:53 AM
Frankly, I don't know the precise answer to your question... But I suppose that might occur when there's a "loop" sequence in your script... Anyway, sounds weird to me that a simple JS script can rise your CPU usage up to 100%... Never saw that before... hm...

... or try to run, if possible, each function a time...

liorean
09-04-2003, 12:11 PM
Well, I've seen this happen, especially in moz during the 0.9.2 to 1.0rc3 period but also in iew and in op (though op never consumes more than 70% of the CPU for some reason). The easiest way is to put alerts after each executed part, telling you what has just executed. Don't put the alerts in loops however, unless you have localised the problem to one loop. Then you can remove the other alerts and concentrate on the loop. However, there might sometimes arise hidden infinite loops from obscure things, such as the combination of one background-image on the html tag and another on the body tag in moz (using css). Also, working with the DOM is extremely resource demanding, and if you're doing much work in it, you might well go up to 100% CPU for a time.