Memory Hogs v1.45 – A PC performance activity monitor and alert system

[Note: v1.45 is online.  Fixed a couple of typos. Fixed window sometimes popping up dead center instead of chosen corner. Added popup menu when left clicking on Tray icon. Download from here MemoryHogs]

While noticing how slow my browsing sessions at home could get, I thought it would be nice to try and monitor the situation and ‘diagnose’ what is going on. I use Firefox routinely, It is a one process browser and can grow to use a lot of RAM. I’m talking 900 megabytes, 1200 megabytes or more. And sometimes when it gets that high, it is a runaway process that needs to be killed. I highly recommend an add-on called “YouTube – Flash HTML5.” With it, you switch between Flash videos and HTML5 videos. Sometimes Flash just goes wild and crashes Firefox.

While searching for clues on writing an application to monitor processes, I came across the basic code for getting a list of process names, RAM usage, Path, etc. I created the basic program around that. I later saw some AutoHotkey code for a CPU Load graphical monitor. And I also read up on Win32_Process more. I filtered the list on only processes that have a window associated with them. Other processes are service or ‘background’ processes, for lack of a better word.

Currently, users can choose how many processes to display, the RAM and the CPU Thresholds, over which the Memory Hogs window will be displayed.

Memory Hogs can alert users of the following:

  1. When any process uses more than a certain amount of RAM.
  2. When any process is ‘Not Responding’ a Tray Tip window will be displayed.
  3. When the CPU Load is over a certain percentage.
  4. When free Disk space is below a certain amount.
  5. When Used RAM is above a certain percentage.
  6. When Used Pagefile is above a certain percentage.
  • Item 1 will be checked if a process is over the threshold.
  • Item 2 will be displayed at the bottom right corner if a process has been Not Responding for at least 9 seconds. This value can be changed in the settings file.
  • Item 3 will flash the CPU Load when threshold is reached.
  • Item 4 will only be displayed when the computer name is added to the settings file using the ShowDiskSpaceForPCsNamed variable matches the current computer. (Since fixed disk space is rarely an issue today this alert is not enabled by default.) [For some systems like Virtual Desktops, the amount of disk space may well be 10gb or less and free space would be important to track.]
  • Item 5 defaults to Used RAM greater than 90% and will flash an alert.
  • Item 6 defaults to Used Page File greater than 90% and will flash an alert.

Double-clicking a process will allow it to be killed. Right double-clicking will display the process folder in windows explorer. It can run in Stealth Mode and log these events for you to check later on.

Some screen shots and more information are below.

Main Window showing 10 Top Processes, 800mb Process alert and 90% CPU Load alert.

Setting Process Threshold to 150mb shows two processes over the limit

General Program Info

Program Icon right-click menu

Mouse over the Program tray icon to see current settings and CPU Load / Top Process at the bottom.

View Settings File

View Logs for Not Responding, CPU load and Free Diskspace

Double-click a process to Exclude it from the Not Responding tray alerts. Excluded processes will be highlighted like you have clicked them in the list. This is just a quick visual indicator.

Later on you can double-click the same process to Include it in alerts again.

The help instructions from the program are below.

v1.29 –
Pressing ALF-F at the Main window will Freeze it so you can make changes to the numbers and double-click any processes to Exclude them from or Include them into the Not Responding alerts. Click Update then press ALT-F when you are finished to “Thaw” the display.

v1.28 –
Added two more Memory alerts to the main window, Used Physical RAM percentage and Used Pagefile percentage.

v1.27 –
Create a shortcut for the program with parameter, either s or S, and it starts in Stealth Mode with no visible output. (i.e. command line is memoryhogs.exe s)

v1.26 –
Changed Refresh button to Update. Now you can change the values then click Update to see the effect without the program restarting. Pressing Escape key hides the window and set AlwaysShow OFF.

v1.25 –
For processes that frequently go Not Responding you can Exclude them from showing alerts by double-clicking them and choosing EXCLUDE. They will be displayed as gray or highlighted color to denote Excluded. If your double-click them again you can choose INCLUDE and they will alert on Not Responding. Processes that go over the RAM Threshold displayed with a checkmark.

v1.24 –
Users can click on the Tray icon to Show or Hide the main window now.

v1.23 –
Added a limiter for Not Responding processes called aProcessSeconds. It defaults to 9 seconds a process has to be hung to display an alert. This is three times through the normal 3 second scan interval. This can be added to MemoryHogs.ini and changed there (i.e. aProcessSeconds=12 would be 12 seconds before an alert). This is to cut down on very brief Not Responding periods for processes which caused a lot of flashing popup messages in the system tray area. This number should be a multiple of 3 since the refresh cycle is 3 seconds between re-displaying the processes.

Memory Hogs v1.22:

A small program that lists processes when one or more of them are using more memory than a desired threshold. If the process is run away or frozen, left double-click it to close it. Right double-clicking will open the folder the process is running from. You can set the number of processes to list, the memory threshold then Refresh the window. The Home, End, Page Up and Page Down keys may be used to move the window quickly to any corner. You may also right-click on the program icon and choose Always Show to have the window remain visible even when no processes are over the threshold. The processes are updated every 3 seconds.

Recent changes:

v1.22 –
Added auto updater code

v1.21 –
Added Stealth Mode to hide the program completely but log all types of activity. Previous Alert statuses are saved when going to and from Stealth Mode. You can type @mhoff to turn off Stealth Mode.

v1.20 –

Added Hotstring commands to augment right-click menu for keyboarders.

@mhs    – Show On/Off
@mhh    – Hide (Show Off) or press ESCape
@mhi    – Show Program Info
@mhr    – Restart/Refresh
@mhca   – CPU Alerts On/Off
@mhda   – DISK Space Alerts On/Off
@mhra   – Used RAM Alerts On/Off
@mhpa   – Used Pagefile Alerts On/Off
@mhnra  – NOT Responding Tray Tip Alerts On/Off
@mhvl   – View Logs
@mhvs   – View Settings
@mhas   – AutoStart On/Off
@mhex   – Exit/Quit Program
@mhon  – Stealth On
@mhoff – Stealth Off

v1.19 –
Use View Log Files to pull up each file into Notepad

v1.18 –
Added Log All Alerts option to the menu. If selected, then CPU, Disk and Not Responding Alerts are logged into three separate files under c:\temp.

MHOG-CPU.csv
MHOG-Diskspace.csv
MHOG-NotResponding.csv

v1.17 –
Program always alerts on Memory Hog processes but now has a menu for CPU, Disk and Not Responding Alerts that can be turned on and off.

v1.16 –
Program has an AutoStart menu option now.

v1.15 –
Some menu item name changes.

v1.14 –
Optionally, if you set a PC name in the MemoryHogs.Ini file, the program will track free disk space and alert when it is too low. Set or add ShowDiskSpaceForPCsNamed to your computer name and you will see the window displayed if your PC has less than the desired diskspace.

v1.13 –
Process Status is now displayed. Background (window less) processes are no longer shown. Active is good, Not Responding is bad if it persists.

v1.12 –
The program starts in Always Show mode to set your initial values.

v1.11 –
An additional alert has been added for CPU. If the CPU is 90 percent loaded then the window will be displayed and the CPU percent will flash. You can set the CPU Load as you like. Some text formatting changes have also been made. CPU Load is shown when the mouse is over the program tray icon.

Still under development! hogversion hogchanges

Process Monitor / Window Logger – AutoIT scripts

WINDOWS LOGGER

In late summer of 2015, I was looking at some programming videos and ran across one showing how simple it is to run a script in the background that grabs keystrokes. This type of application is called a key logger and are usually used for “up to no good” activities. I was interested in whether I could apply this to logging how much time users spend in each application and log that information when they switch from one program to another.

My daughters are older now, but, this type of program could be used to monitor where young people (or old :-)) go on the internet, for example. Still, I thought I would pursue writing a script that I call Windows Logger. The basic theory is that the script grabs the current program name and window (document) title. It starts a timer and when it detects a different active window, it saves a log entry with the last program used and the time spent there. Some hotkeys control various features of the script as it runs unseen in the background. The program can be set to run on startup. If users request it, I can make the function key assignments changeable.

A couple of screen shots are below. The PDF documentation and executable are in here. windows-logger

process-monitor-help

windows-logger-2

 

PROCESS MONITOR

At work, we sometimes have users whose computers are very slow or have applications that frequently are hung or “Not Responding.” I felt it could be good to have a program log those events for the purpose of knowing which application(s) are misbehaving. Process Monitor is very similar to Windows Logger but it only logs entries for processes that are frozen, hung or “Not Responding” for say 20, 30 seconds or more. Many, many programs go unresponsive when computers start up or when programs are loading the first time for the day. By looking only at process that remain hung for a while, one knows that they are not working properly. Some hotkeys control various features of the script as it runs unseen in the background. The program can be set to run on startup. If users request it, I can make the function key assignments changeable.

A couple of screen shots are below. The PDF documentation and executable are in here. process-monitor

process-monitor-help

process-monitor-stats

 

 

process-monitor-csv

Simple Work Timer

While reading an online article I found a program that would total up the time spent in up to 3 applications. I thought it was worth exploring so I added the ability to track as many programs as is needed. I also added two timers, one for Slack time, one for time spent in any program in the saved list. Users can see the total time spent in each program, make the window semi transparent, etc. When you are in a program that is not being tracked, the window will be orange. Once the program has been added to the menu and you are using it, the window will be blue.

A download is found here. worktimer And screenshots are below.

The initial window
work-timer1

Choose App 1 (Not set)
work-timer2

The program is now waiting for you to click inside one of the applications you want to track time.
work-timer3

In this example, I clicked on a program called Greenshot and it is now tracking time for it.
work-timer4

Do this for each program you want to track time on. If you have more than 12 programs then click on Program Items and bump up that number.

work-timer9

work-timer5

After some time, I click on the menu and choose Timer Summary to see work-timer6

16 seconds in Greenshot, 1 second in Windows explorer, almost 5 and a half minutes of Slack or uncategorized time.

You can set how many seconds of inactivity before Idle time is counted, the number of items in to track (always make it more than you have already entered), and an optional transparency value.

work-timer7

When you are done with today’s summary then select Restart Timers to zero every one and begin tracking again.

work-timer8

Diary Assistant v1.16 for Stickies 9.x

[Diary Assistant v1.16 is available here.  stickiesdiary]

While researching software for saving daily notes and other information, I have run across several free applications that are noteworthy.

For a couple of years, I have used RedNotebook to save daily notes at work. It works pretty well but occasionally doesn’t “close right” and tells me that the next time I run it. It allowed me to quickly search for any text in any daily note. Very handy.


Recently, I moved to a similar program called CherryTree with which you can store notes in a tree with any level of subordinate tree note that you desire. And it had the awesome press F8 key which either creates a note for today or takes you to an existing one. This feature made it very handy as a daily journal and it is more flexible than RedNotebook. A couple of screen shots are below.


CherryTree did most of what I want in a note taking application. At least until I found a couple of long available Sticky Note applications. PNotes and Stickies 9.0c are venerable sticky notes freeware programs. I had seen them a couple of years ago but didn’t pay close enough attention to a breathtaking feature — attaching notes to documents, web pages and/or other active programs.

I always felt that having half a dozen, a dozen, or more notes on my monitors would just be too much clutter and too distracting to use comfortably. But, when you can create a note and attach or pin it to a specific document, then the usefulness is greatly multiplied. The original PNotes is smaller and lacks a crucial feature when pinning a note to a document. It can only pin a note to a specific document or web page. That works well, but, I wanted to pin notes to programs also. Their newer program, PNotes.NET has the ability to use wildcards when pinning notes and is much more flexible. Their dark theme leaves a lot to be desired though. Below is a screenshot from PNotes.NET showing a sticky note for December 5th.

PNotes creates a Diary group and creates a daily note when you press Ctrl+Alt+D. You can hide the note and return back to it any time. If the day has changed then just look under Diary for daily entries. PNotes does a real fine jobs of managing sticky notes but it also requires Microsoft .NET 4 Framework, hence the name PNotes.NET.  While .NET has been around for a long time, it is quite a bloated piece of programming, in my opinion. And there are usually many security updates for it every year.

In order to hopefully stay away from needing .NET, I took another look at Stickies 9.0c from Zhorn Software. It is a very small application at less than 2mb download. It has pretty much the same features as PNotes with some functions named differently. With Stickies 9.0 you can create the following: 1) Desktop Notes which are always visible until you are done with them, 2) Stored Notes which are saved until you delete them, 3) Attached Notes which are only visible when a specific document, web page or application is visible (yeah!), 4) Sleeping Notes which reappear after a designated time and 5) Recurring Notes which popup at intervals and days you choose. Below are some screenshots.

Attaching a note to a window, in this case, a web page, makes that note appear when the web page is browsed to as shown below.

As soon as I click on another web page or program, the Freeware Files sticky will disappear. This makes having lots of sticky notes easy to manage and make much sense in a computer setting. Otherwise, they are not much more than physical sticky notes. I realized that one feature was missing in Stickies 9.0c that was in RedNotebook, CherryTree and PNotes. The Diary or journal feature was nowhere to be found. Having been writing some script and freeware applications the last year and a half, I decided to see if I could program this feature or bolt onto Stickies 9.0.

What I came up with is a script that allows users to add and update Diary notes via either short text commands or a right-click menu. Users can also search Diary notes for the month and the year. I called the add-on “Stickies Diary Assistant” and here are some screen shots.

By using and manipulating the Manage stickies window, I was able to create and search on diary notes. If you choose Add Diary Stickie or type @dt in an editing window, you will be asked to create a note for today. Or you’ll be taken to that note in the Manage stickies window.

create-diary-sticky 

The program starts with a rather plain design or skin like a paper sticky, but, allows for sophisticated stickies with toolbars just like mini word processors.

sticky-skin1

sticky-skin2   sticky-skin3

In order to add another entry choose Add Diary Entry. This will add a separator to today’s note.

The other features of Diary Assistant are for searching notes.

 Month search

Year search

Any text search

When you are done with today’s note you need to Store it. I created a Diary group to put mine in, but, you can categorize it any way you want.

   

At any time you can press Ctrl-Alt-M to display Manage stickies then search on your notes. Or choose Search All Stickies from the Assistant’s tray menu, enter your text then click OK.

For now, I will be using CherryTree and Stickies 9.0c to manage a lot of different information at work and at home. Yes, I know I could use MS OneNote, but, I have a predilection for small, portable software programs.

One or more of these program could benefit you in your work or home office, you should give them a try.