The MASM Forum
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 03, 2010, 04:57:17 am

Login with username, password and session length
Search:     Advanced search
116888 Posts in 13958 Topics by 1631 Members
Latest Member: anglear_
* Home Help Search Login Register
+  The MASM Forum
|-+  General Forums
| |-+  The Workshop
| | |-+  HDD activity monitor
« previous next »
Pages: [1] 2 Print
Author Topic: HDD activity monitor  (Read 2957 times)
MichaelW
Global Moderator
Member
*****
Gender: Male
Posts: 4240


HDD activity monitor
« on: March 11, 2006, 09:05:33 am »

The attachment is an HDD activity monitor app that uses the Performance Data Helper (PDH) DLL functions to monitor disk read/write activity. The app uses an invisible window to handle the messages, and displays an icon in the taskbar status area (AKA system tray). I modeled the icon, tooltip, and popup menu code after Iczelion's Win32 Assembly Tutorial part 23, correcting a problem with the menu not closing when the user clicks outside the menu. In the course of doing this I discovered that the status area does not display some icons correctly (even 16x16x4bpp icons), and that it is difficult to eliminate flicker in animated icons. I tested under Windows 2000 only.

MSDN: Performance Monitoring, Performance Data

MSDN: Using the Taskbar

EDIT: After 42 downloads I replaced the attachment with a version that derives the object and counter names from the index values. This should correct the problems with localized languages other than English. I wonder why Microsoft did not provide for localization of the instance name (in this case ‘_Total’).

* hdactmon1.zip (4.75 KB - downloaded 307 times.)
« Last Edit: March 14, 2006, 02:11:42 am by MichaelW » Logged

eschew obfuscation
skywalker
Guest


Email
Re: HDD activity monitor
« Reply #1 on: March 11, 2006, 02:09:27 pm »

The attachment is an HDD activity monitor app that uses the Performance Data Helper (PDH) DLL functions to monitor disk read/write activity. The app uses an invisible window to


It works great under XP SP2.

Logged
Mark Jones
Drifting in the Abstract
Member
*****
Posts: 2302


=- Stargate Atlantis -=


Re: HDD activity monitor
« Reply #2 on: March 11, 2006, 07:11:01 pm »

This is great Michael, thanks! BigGrin
Logged

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08
Vortex
Raider of the lost code
Member
*****
Gender: Male
Posts: 2960



Re: HDD activity monitor
« Reply #3 on: March 11, 2006, 08:06:45 pm »

The application fails on my Win XP HE Sp 2 and displays a message box saying :
Quote
PdhAddCounter failed
Logged

MichaelW
Global Moderator
Member
*****
Gender: Male
Posts: 4240


Re: HDD activity monitor
« Reply #4 on: March 11, 2006, 09:41:57 pm »

Hi Vortex,

Thanks for testing. I’m not sure what the problem could be, and I currently have no way to test under anything but Windows 2000 SP4. The attachment is a version that includes some additional PDH constants and reports some additional information. Hopefully, this will make it possible to identify the problem.

MSDN: PdhGetDllVersion

MSDN: Checking PDH Interface Return Values


* hdactmon_dbg.zip (5.33 KB - downloaded 168 times.)
Logged

eschew obfuscation
PBrennick
Never be satisfied
Member
*****
Gender: Male
Posts: 2083


Never under-estimate the power of an idea


Re: HDD activity monitor
« Reply #5 on: March 12, 2006, 02:26:51 am »


It is working well on my machine, this is a pretty cool idea!
Paul
Logged

The GeneSys Project is available from:
The Repository or My crappy website
PBrennick
Never be satisfied
Member
*****
Gender: Male
Posts: 2083


Never under-estimate the power of an idea


Re: HDD activity monitor
« Reply #6 on: March 12, 2006, 02:39:56 am »

Erol,

I ran MichaelW's debug version on my WinXP HE Sp2, I got the following results,

00000503 is the version of pdh.dll

Counter Path
\\GeneSys\PhysicalDisk(_Total) %Disk Time

Paul
Logged

The GeneSys Project is available from:
The Repository or My crappy website
farrier
Member
*****
Posts: 209


Re: HDD activity monitor
« Reply #7 on: March 12, 2006, 04:49:05 am »

MichaelW,

As Khan's son would say to his father: "Yours' is a superior method!"

I've been playing with it today.  I have not yet found a list of the objects and counter, or an explaination of them.  But I did write the attached program--FASM syntax--to show a list of those available on the users machine.  Quite simple.

In my research, I found a note that PDH was available and usable on machines on which the Platform SDK was installed!

Thanks,

farrier

* PdhBrowseCounter.zip (1.71 KB - downloaded 156 times.)
Logged

It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)
MichaelW
Global Moderator
Member
*****
Gender: Male
Posts: 4240


Re: HDD activity monitor
« Reply #8 on: March 12, 2006, 06:39:21 am »

farrier,

Thanks for the code. I now have an incentive to finish the PDH include file for MASM that I recently stopped working on.

According to this 1998 arcticle PDH.dll is available only with the PSDK.

But according to this and this PDH.dll shipped with Windows 2000.

And according to the DLL Help Database it shipped with all versions of Windows after Windows 2000, including Windows XP SP2.

Logged

eschew obfuscation
farrier
Member
*****
Posts: 209


Re: HDD activity monitor
« Reply #9 on: March 12, 2006, 02:12:20 pm »

MichaelW,

I think that is the very article I had in mind when I posted.  Thanks for the other links!  I'll play some more with this.

Again, thanks for the original post, I'd never seen this before, or never took notice of it.

farrier
Logged

It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)
BytePtr
Member
****
Gender: Male
Posts: 76



Re: HDD activity monitor
« Reply #10 on: March 12, 2006, 03:56:34 pm »

Nice work Michael  ThumbsUp
XP Pro (no SP's), no problems found, works like a charm.
Logged

Timbo
Member
****
Posts: 59


Re: HDD activity monitor
« Reply #11 on: March 12, 2006, 04:12:06 pm »

Michael,

XP Pro SP2: flawless execution.

Vortex:

It is possible to disable disk performance monitoring on 2K/XP workstations.  Is it possible you have done this and neglected this detail in your recollection?

Regards.

Tim
Logged
Phoenix
Member
*****
Gender: Male
Posts: 136



Re: HDD activity monitor
« Reply #12 on: March 12, 2006, 05:23:02 pm »

Michael,

doesn't work for me, too --> Win XP SP 2, german language.

AFAIK, the names of the counters are stored in localized language: % Disk Time in english (US) is Zeit (%) in german (on my system). I had similar problems when i tried to use pdh.dll to retrieve CPU performance.

Try PdhLookupPerfNameByIndex, the index seems to be the same in each language (200 for % Disk Time).

Code:
;-- Retrieve performance object name by index: "% Processor Time"
mov dwBufferSize,MAX_PATH
Invoke GlobalAlloc,GPTR,dwBufferSize
mov pcpe.szCounterName,eax
Invoke PdhLookupPerfNameByIndex,pcpe.szMachineName,6,pcpe.szCounterName, ADDR dwBufferSize

This one solved my problem.

Regards, Phoenix
Logged

Go the extra mile. It's never crowded...
MichaelW
Global Moderator
Member
*****
Gender: Male
Posts: 4240


Re: HDD activity monitor
« Reply #13 on: March 12, 2006, 09:49:57 pm »

Thanks Phoenix,

I recall seeing where you used index values in your CPULoad_pdh.asm source, but I failed to recognize your reason for doing so. When I started coding this I could not find a table of index values, so I selected the path of least resistance. Time for an international version.


Logged

eschew obfuscation
Phoenix
Member
*****
Gender: Male
Posts: 136



Re: HDD activity monitor
« Reply #14 on: March 13, 2006, 06:05:11 am »

Michael,

in attached file is a list with indexes. Not well formatted, but it helped me....

Regards, Phoenix

* Index Eng.zip (8.14 KB - downloaded 149 times.)
Logged

Go the extra mile. It's never crowded...
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!