2009-07-13

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

2009-07-02

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