Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CPU/RAM usage question 3

Status
Not open for further replies.

AliJay

Technical User
Sep 19, 2004
27
SG
Hi Guys,

I use my IBM ThinkPad (1.8GHz Intel Pentium 4, 1.0GB RAM running MS XP SP2) to monitor constantly changing parameters using Excel, which runs a macro every 2 minutes to update. The monitoring lasts for several hours per day.

My question is that when I start running the machine (1st hour of usage) total CPU peaks at 50 to 70% But gradually the usage goes up and up until after (say) two hours is stuck at 100% and performance gets very slow indeed. This can be remedied by closing all programs and rebooting. However, after a couple of hours it all starts slowing down again. Is there a way of (for want of a better word) refreshing the CPU without having to reboot? I bought something called "MemoKit" which is supposed to speed up the system but results are marginal.

I would really appreciate any input that you could give,

Best regards

John
 
Not positive about what you are doing?? Collecting data via excel??

Try enabling 'auto save' in excel at some interval. See if saving perodically removes some of the cpu/ram overhead.

rvnguy
"I know everything..I just can't remember it all
 
Hi - sorry of I confused you. I have the Excel workbook connected to a datasource on the web via something called DDE. It means that as the values change it updates in the Excel spreadsheet itself.

I have tried Autosave but the CPU usage keeps just going up.

Thanks and sorry again.

John
 
When it slows down open Task Manager and have a look at the processes. Sort them by 'CPU' so you can see which has the highest usage - that should help you to figure out what's hogging all the processing power. It could be badly-written Excel macros in which case the solution is to re-write them.

I had a similar problem when I first upgraded my PC to SP2 - I had a 'svchost.exe' process that gradually gobbled up more and more CPU time, so that after a couple of hours the system was unusable. I never found out why and ended up re-installing Windows. If you've been on SP2 for a while and only just experienced the slow-down this probably isn't your problem though.

Regards

Nelviticus
 
Thanks Nelviticus - Please have a star.

It looks like it's the "badly written macros" then! Doh - I wrote them myslef :) Oh well. I'm not sure how to write good ones. I think that's a topic for another forum.

Just to clarify though - there is no process or software that can clear the CPU like a reboot can?

All the best

John
 
In your case, re-booting helps because it stops all the running applications and processes. You could achieve the same result by closing and re-opening whatever is hogging your CPU. You could probably find something to do this at regular intervals but you'll need to know which things to stop - you can't just shut down all processes because some of them are necessary for Windows to function.

You really need to track down which process/application is causing the slow-down. If it's a system process (such as svchost.exe) then it could be a symptom of a wider problem. If it's Excel, it may be easier to fix the macros than to find something which stops and re-starts it.

The VBA forums here on TekTips are very active and full of very good people, so if your problems are down to dodgy macros I'd recommend looking there first:

Regards

Nelviticus
 
It is excel - I'll give it a go.

Thanks again - all the best

John
 
Just to help highlight the difference, I think that there may be a misconception here about the difference between CPU and memory utilization.

Memory is essentially storage made up of "pages" of space for data. When you are at 50% memory utilization, then half of the memory (storage space) available to your system is in use. When you run out of available RAM (actually before you get to that point, but I'm trying to keep it simple) Windows will swap some of those pages of data from memory to disk (start with the least frequently used pages). They are stored in the page file (also called a swap file). Sometimes programs, scripts, macros, or other processes are poorly written and they do not release or clean up the memory that they were using when they terminated. Sometimes a process can terminated abnormally (aka, crash) before it gets a chance to free up the pages in memory that it was using. In these cases you'll end up with memory being allocated or marked as used that is actually no longer in use. Generally what a memory cleanup program does is to check the pages that are shown as allocated in memory, determine which pages are actually available even though they show otherwise, and then free up those pages. Sometimes this can free up a lot of memory, sometimes not. It mainly depends upon how your sloppily the processes that you are running were written.

CPUs are completely different. They are actually doing the work of processing data on a computer, as well as moving data around, etc. The CPU's processing power (and this is a vast oversimplification) is divided into processing cycles. The faster the CPU clock, the more cycles the CPU can complete within one second. For example, a 100 MHz CPU can complete 100 million cycles per second, a 200 MHz CPU can complete 200 million cycles per second, etc. When you are looking at CPU utilization on a PC, you are looking at the percentage of cycles per second (on average) that your CPU is actually doing something. So if your CPU is running at 50% utilization, it is only doing work half of the time. During the rest of the processing cycles the CPU is sitting idle. If CPU utilization reaches 100% then it is doing something 100% of the time. There is no way to offload some of this work to another part of the system without adding additional CPUs. In this case the only way to "free up cycles" is to stop processing something, aka, end some programs/processes. Sometimes there is an application that doesn't share CPU time very well that is utilizing all or a majority of the CPU cycles, and closing that application will reduce CPU utilization. Of course, that isn't much help if you need to be running everything that is running.

The one thing that does come to mind in your situation is to see what your memory utilization looks like. If you start running low on RAM and your system has to swap the memory out to disk, then that will consume CPU cycles as well. Even if you aren't swapping out to disk, all of the work of memory management could be bogging down the CPU. When your CPU starts to get up towards 100% utilization, how much memory is Excel using? Is that amount still growing? If so your problem may just be that Excel is generating so much data that the file becomes too big to reside in memory.

The other thought is that something that you're running may create a memory leak condition. A memory leak is when a program doesn't manage memory properly and just continues to consume increasing amounts of memory until you eventually run out. You may want to install relevant updates/patches to your applications to see if that helps.

If none of that helps, you're probably best off looking at your macros.
 
Thanks for taking the time to write kmc - I think we all will have learned a tremendous amount from your post. You're a star!

There are two main programs using the RAM - one is mcshield.exe which (I find) is part of McAfee's anti virus suite and constantly scans when online for Viruses, Trojans etc and the other is Excel and as was said the RAM usage grows as time goes on - actually for both. It seems to be a combination of the growing RAM (even with 1GB of RAM) usage of these processes that bog down my CPU. The "Free Physical Memory Monitor" says there is still over 650 MB of RAM free. hmmmm.

I will get onto the VBA forum too.

Your help (education) here has been VERY much appreciated.

All the best

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top