|
-
Feb 13th, 2008, 05:19 AM
#1
Thread Starter
Frenzied Member
[2008] HIGH cpu usage on single core 1.3ghz laptop
I have seen two forms of my application using between 10-50% for one of them, and the other using 30-50% of CPU...
Could this be because I have several large 400 KB images in My.Resources, as well as many other little images..
?? I know it's a crappy laptop, but I really would like my application to work nicely on it...
Any idea's what this could be?
Cheers
-
Feb 13th, 2008, 11:41 AM
#2
Re: [2008] HIGH cpu usage on single core 1.3ghz laptop
Is this the same app that has all those short interval timers? If so, that's where the processor time is going.
My usual boring signature: Nothing
 
-
Feb 13th, 2008, 06:07 PM
#3
Thread Starter
Frenzied Member
Re: [2008] HIGH cpu usage on single core 1.3ghz laptop
I see, but the code in the 'short' interval timers, is very small...
One has 10 ms, which checks a few things against the registry, it checks if a process is running, and checks if a file does not exist, and if it does, it creates it..
That can't do much can it? or is it the speed of the timer and not the code in the timer?
Cheers
-
Feb 13th, 2008, 07:00 PM
#4
Re: [2008] HIGH cpu usage on single core 1.3ghz laptop
It's a combination of both, quite likely. Try timing how fast you can press a button. You can probably get below 100ms, but I'd bet you can't get to 10ms, or even close to there. So you are doing a couple pieces of disk IO, memory IO, etc. at a rate that is so fast that it might happen ten times in the time it takes you to press a button twice.
Now, how do you check CPU usage? Does that graph show you a ms by ms count of usage? Probably it is showing you a running average across some significantly longer interval of time. Your timer is firing many times during that averaging window, and though the code you have written may consist of few lines, they are not all that insignificant in processor impact as they appear to deal with a great deal of memory and disk thrashing.
Why are you doing those steps that fast? What could possibly be killing off a file and deleting a registry entry at such a pace that it would have to be restored dozens of times in the blink of an eye? Heck, setting that timer to 100ms would mean that it would be happening faster than you could even consider manually deleting a file.
I'm working on something that processes incoming data, but can't tie up the processor too much, and doesn't really know when the data will arrive. After some thought, I realized that there was no point in setting the timer faster that 5s. You might well have reason to go with a much faster speed than that, but consider what it is you are guarding against with the timer. If you are guarding against a person shutting off software, an interval of 1000ms is probably going to be plenty fast enough, since people can't do much of anything that fast on a computer. If other processes require those other items you mention, wouldn't it be better to have the process do the checking itself rather than bog down a timer that will be dealing with an exceedingly rare event?
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|