Monday, July 13, 2009

CPU Utilization - Diagnostics

Howto: Windows Vista - How to tell CPU Utilization; how to diagnose which programs are causing excessive CPU utilization. This is a repeat of the text typed in a previous article "AVG CPU Utilization."

If you suspect your computer is slow, here is how you can diagnose or prove the problem. To see how busy your computer is, do the following:




1. On any empty spot on the task-bar, other-mouse-click and choose "Task Manager". Alternately, ctrl-alt-del, choose "Task Manager". Click illustration for a larger view; click 'Back' to return.


2. Display all of the tasks running:

* In Task Manager, click the top [Processes] tab
* Near the bottom of the panel, click "Show all processes for all users"
(You must click this button to get a clear picture of the process list.)

3. Change the Sort Order, showing the biggest hogs first:

* On the top column-bar, click the word "CPU" twice to change the sort-order -- largest tasks are first.

On most computers, "System Idle Process" should be at the top of the list. (If you do not see System Idle Process, see step 2.)

The list will flux and change; this is normal. Every program listed here is "running" -- although some take such little CPU time they register "00" (zeroes).


Watch the list. As a program gets the CPU's attention, it jumps higher in the list and the CPU column will show a higher percentage. Some tasks will jockey for second and third place, changing positions often; this is normal. The task-monitor itself takes one or two percent so you should not leave this program running.

Comments:

  • At the bottom of the panel you will see "CPU Usage xx%". Assuming you are not downloading a file or watching youtube videos, CPU usage should be around 3% to 5%. If yours is hovering around 20 or 30%, then something is wrong. See the bottom of this article for related links.
    For example, on my computer, even though I am running a photo-editor, word processor, browser, and a database, CPU utilization is still at 2 to 3%.

  • "System Idle Process" is an indication on how bored your computer is. If this number hovers in the high 90's (99, 98%), then this means the computer is simply waiting for you to do something and this task will statistically always be at the top of the list. This is good.
  • Other tasks in the list occupy varying amounts of CPU utilization and memory. In my recent cases, AVG Antivirus was hovering around 25% on an idled system (making the System Idle Process around 75%).
The screen shot above was captured on a healthy system; I did not capture an image for this article.

What does each program do?

On most machines I have worked with, they have so many programs loading at startup that the computer becomes bogged down, sluggish, and unusable. You will find toolbar programs, printer monitoring programs, automatic updates for Acrobat, background processes that remind you to pay your bills, and the list goes on. New computers have all kinds of trial software installed, and you might find expired virus scanners and the like -- all of this is commonly called "crap ware."

The exe names in the list can be obscure and you may need to search the web to find out what programs launched the task. In this article, Cleaning up Startup Programs, I detailed how to remove these programs.

Related Articles:
Cleaning up Startup Programs
Vista Spiffs
AVG CPU Utilization

MSConfig Nag

Howto: Getting rid of the MSConfig balloon prompt "Windows has blocked some startup programs." (MSConfig annoyance nag)

I recommend occasionally running MSConfig to clean-up startup programs. You can read all the reasons here.


But you may get bugged with this balloon message: "Windows has blocked some startup programs".

Getting Rid of the Prompt:

1. Right-click on the MSconfig System-tray icon (the prompt in the lower-right corner, after a boot).

2. Choose "Run Blocked Program";
Choose "System Configuration Utility".
If you do not see this choice, see Exceptions, below.

3. The next time you reboot, you will be presented with this prompt: "Don't show this message or startup system configuration when Windows starts". Check the box and OK. This will remove the annoying prompt.


Exceptions:

If you dive into the "Run Blocked Program" menu but do not see 'System Configuration Utility' and instead see another program, whose name will vary, do these steps:

A. Run MSConfig and take this program out of the startup list:

  • Launch MSConfig
  • In the [Startup] tab, look for the offending program and uncheck it (which disables the program). At the next boot, the prompt should be gone.

Of course, all this begs the question: Why didn't Microsoft simply give you an option in the popup window to stop prompting? Perhaps Windows 7.

Related articles:
Cleanup Startup Programs
Streamline Startup Menus
Vista Spiffs

Sunday, July 12, 2009

AVG CPU Utilization

Howto: Instructions on how to tell if AVG 8.5 is hogging too much CPU utilization - 100% CPU utilization, along with steps to fix the problem. This article was originally written for version 8.5 and has not been tested with version 9.0. Near the bottom of this article are steps on how to tell your CPU utilization.

In previous posts I have recommended AVG's free virus scanner, version 8.5. But on the last three machine's I have worked on, the virus scanner hogged large amounts of CPU and I can see from Keyliner's web-traffic, this continues to plague many readers. Because of this, I no longer recommend installing AVG's scanner (See this keyliner article: Using MSE).
However, the remainder of this article discusses possible solutions.

The computers in question were capable machines, with plenty of RAM and they were virus and spyware free, and yet, they were still beat to death by background processes. And I confirmed that AVG was not trying to update itself in the background. I've spoken to colleagues and they report similar experiences.

It took a while to find a likely solution and the following steps have solved this problem on the past several computers I've worked with. Near the end of this article are diagnostic steps you can use to determine if your computer is running slow.


Fixing the Problem:
Jumping to the solution, I found this tid-bit on AVG's forums (later in this article are steps on how to diagnose the problem in more detail):

If you notice AVGemc.exe causing 100% CPU utilization, or otherwise slowing down your machine, re-install AVG in custom mode with ONLY the MS Outlook plug-in. Do not install the Bat! or Personal E-Mail Scanner plug-ins.

In fact, AVG recommends if you're using Outlook, only install the MS Outlook plug-in. If MS Outlook Express, use the Personal E-Mail scanner plug-in. (Basically, uncheck the other options, see illustration below).


My recommended steps:
These steps are for the "Free" version (and may or may not work on their demo/commercial version).

1. Uninstall AVG and reboot, as instructed
2. Re-Install AVG.

Use this link to download the software: Note: Since this article was written, AVG has now released version 9.0 and this link takes you to the download page; be sure to select the Free version (not the free-upgrade version)

Link:
AVG's Free AntiVirus
(When installing AVG, be sure to download the Free version, which is different than the Trial version. It may take a moment to find it; as of 2009.10, this link takes you directly to the page.)


3. Choose Custom Install
4. Accept the default path

5. Choose these custom options:

If you use Outlook Email:
Uncheck "Link Scanner"
Uncheck "Bat Plug in"
Check Plugin for Microsoft Outlook
Uncheck Office Plugin

If you use another Email Client:
Uncheck "Link Scanner"
Uncheck "Bat Plug in"
Check "Email Scanner" only
(Uncheck Microsoft Outlook Plug In)
Uncheck Office Plugin



6. Allow the software to install.

Other Concerns: Windows Defender:

AVG also has a spyware scanner -- with no apparent way to disable the feature. The trouble is, Windows Defender, included with XP SP2 and Vista, also scans for spyware and I suspect there is some competition between the two programs. Although I prefer Defender, I decided to disable Microsoft's program. Follow these steps:

1. Launch Control Panel, Security Center.

2. Choose "Windows Defender" from the left-menu.

3. Choose top-menu "Tools", options.

Scroll down the window, past Automatic scanning (this is not at all obvious).
Uncheck "Use Windows Defender"
Click OK past the various gripes.



4. Return to the Windows Security Center.

In the "Malware Protection", click the down-arrow to expand the section.

Change the Malware protection status to "not monitored" (optionally, click the side-bar 'Change the way Security Center alerts me') -- if not, it will bug you constantly about Windows Defender being disabled -- The security center does not understand that AVG does the same task.

How to Tell: CPU Utilization

If you suspect your computer is slow, here is one way to help prove the problem. To see how busy your computer is, do the following:

1. On any empty spot on the task-bar, other-mouse-click and choose "Task Manager". Alternately, ctrl-alt-del, choose "Task Manager".
 
Click illustration for a larger view; click right-x to return.

2. Display all of the tasks running:

* In Task Manager, click the top [Processes] tab
* Near the bottom of the panel, click "Show all processes for all users"
(You must click this button to get a clear picture of the process list.)

3. Change the Sort Order, showing the biggest hogs first:

* On the top column-bar, click the word "CPU" twice to change the sort-order -- largest tasks are first.

On most computers, "System Idle Process" should be at the top of the list. (If you do not see System Idle Process, see step 2.)

The list will flux and change; this is normal. Every program listed here is "running" -- although some take such little CPU time they register "00" (zeroes).


Watch the list. As a program gets the CPU's attention, it jumps higher in the list and the CPU column will show a higher percentage. Some tasks will jockey for second and third place, changing positions often; this is normal. The task-monitor itself takes one or two percent so you should not leave this program running.

Comments:
  • At the bottom of the panel you will see "CPU Usage xx%". Assuming you are not downloading a file or watching youtube videos, CPU usage should be around 3% to 5%. If yours is hovering around 20 or 30%, then something is wrong. See the bottom of this article for related links.
    For example, on my computer, even though I am running a photo-editor, word processor, browser, and a database, CPU utilization is still at 2 to 3%.

  • "System Idle Process" is an indication on how bored your computer is. If this number hovers in the high 90's (99, 98%), then this means the computer is simply waiting for you to do something and this task will statistically always be at the top of the list. This is good.
  • Other tasks in the list occupy varying amounts of CPU utilization and memory. In my recent cases, AVG was hovering around 25% on an idled system (making the System Idle Process around 75%) -- this is after uninstalling all kinds of other programs and background tasks.
    The screen shot above was captured on a healthy system; I did not capture an image for this article.
What does each program do?

On most machines I have worked with, they have so many programs loading at startup that the computer becomes bogged down, sluggish, and unusable. You will find toolbar programs, printer monitoring programs, automatic updates for Acrobat, background processes that remind you to pay your bills, and the list goes on. New computers have all kinds of trial software installed, and you might find expired virus scanners and the like -- all of this is commonly called "crap ware."

The exe names in the list can be obscure and you may need to search the web to find out what programs launched the task. In this article, Cleaning up Startup Programs, I detailed how to remove these programs.

But even when I had cleaned up the machine, AVG was still porking out a ton of CPU cycles -- about 25% of them and it was consistent.

Conclusion:

It is hard to tell if the de-install/re-install fixed the problem or if changing the installation options and disabling Defender was the trick. In any case, the computers are now operating normally.

Update 2009.01:
This article continues to get a large number of hits each monthly, indicating a continuing problem with AVG. This, along with the poor performance of other commercial packages, including McAfee and Symantec, makes it to where I no longer recommend any of these, including AVG.

I will review Microsoft's MSE in the future. Currently, because of all these hassles, I am no longer running a Virus scanner. A future article on this topic is almost guaranteed.

Please leave a comment if this article resolved your problem (no registration required).

Keywords: AVG CPU Utilization CPU Hog 100% utilization 95% 90% 100% resources

Related Articles:
Windows 7 Explorer Settings
For Windows 7: Start Menu Cleanup

For Windows XP: Streamline Windows XP / Vista Start Menu
Microsoft Security Essentials MSE
:Recommended

Link: AVG's Free AntiVirus

Thursday, July 2, 2009

Using VBA to send Email

VBA Code Example: How to send an email from VBA, passing through the current user's Outlook session.

Using Visual Basic for Applications (VBA), you can send an email from within your MSOffice application via a locally installed copy of Outlook. This code example is from an MSAccess button event. Since it took me nearly a day of research to get this working properly, I decided to upload the code here.

1. In your VBA code, add this recommended statement at the top of the code, above all other procedures:
Option Explicit

2. In the VBA code, select the Top Menu: Tools, References
In the list, scroll until you find "Microsoft Outlook 12.0 Object Library"
Select the library; click OK (Your version may differ)

3. Create a button in your Form (e.g. btnSendEmail)

4. In the button's CLICK event, add this code:

Important Note: I have tried and given up! I cannot get the copy-and-paste to work correctly with Internet Explorer -- When it copies this text, it looses track of the carriage-returns. With Firefox, this works properly. See below for work-around. Suggestions are welcome. Email me if you would like a copy sent directly to you.


Private Sub btnSendEmail_Click()
Dim strmsg as string
Dim OutlookObj As Outlook.Application
Dim OutlookMsg As Outlook.MailItem
Dim OutlookRecip As Outlook.Recipient
'Dim OutlookAttach as Outlook.Attachment

Set OutlookObj = CreateObject("Outlook.Application")
Set OutlookMsg = OutlookObj.CreateItem(olMailItem)

With OutlookMsg
Set OutlookRecip = .Recipients.Add("tim wolf")
'OutlookRecip.Type = otTo

.Subject = "TEST MESSAGE"
.Body = strmsg & vbCrLf
.Importance = olImportanceNormal

'If using Attachments, uncomment this and the line near the top of this routine
'If Not missing(AttachmentPath) Then
' Set OutlookAttach = .Attachments.Add(AttachmentPath)
'End If

'Resolve each recipent's name:
For Each OutlookRecip In .Recipients
OutlookRecip.Resolve
Next

.Display
'or use .Save and .Send to automate the process
End With

Set OutlookObj = Nothing
End Sub

Internet Explorer Users: Follow these steps:
  • Copy the text
  • Open Microsoft Word; paste text
  • Re-highlight text in Word
  • Paste into your code-editor (Excel)

Comments:
  • In the source-code, you must use the keyword "SET", as illustrated. This seems redundant, but the word is required. Without it you will see "Run-time error '91': Object variable or With block variable not set".

  • If you have troubles with the Class or Library not defined, see step 2.

  • Comment-out the .Display line and uncomment .SEND and .SAVE if you want the email to send automatically.



Related Keyliner Articles:
Excel UDF (User Defined Functions)
Using Excel for Raffle-Ticket Drawing: Prizeorama
Excel VLookup - a complete tutorial
Excel Coloring Alternate Rows
Excel Parsing City-State-Zip
Excel Importing Text with Leading Zeroes
VB - Return First Word, Last Word, Supertrim
Using VBA to Send Email
Using Excel to select Raffle Tickets - Prize-orama