|
Pages: [1] 2
|
 |
|
Author
|
Topic: HDD activity monitor (Read 2957 times)
|
MichaelW
Global Moderator
Member
    
Gender: 
Posts: 4240
|
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 TaskbarEDIT: 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’).
|
|
|
« Last Edit: March 14, 2006, 02:11:42 am by MichaelW »
|
Logged
|
eschew obfuscation
|
|
|
skywalker
Guest
|
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 -=
|
This is great Michael, thanks! 
|
|
|
|
|
Logged
|
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08
|
|
|
Vortex
Raider of the lost code
Member
    
Gender: 
Posts: 2960
|
The application fails on my Win XP HE Sp 2 and displays a message box saying : PdhAddCounter failed
|
|
|
|
|
Logged
|
|
|
|
MichaelW
Global Moderator
Member
    
Gender: 
Posts: 4240
|
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
|
|
|
|
Logged
|
eschew obfuscation
|
|
|
PBrennick
Never be satisfied
Member
    
Gender: 
Posts: 2083
Never under-estimate the power of an idea
|
It is working well on my machine, this is a pretty cool idea! Paul
|
|
|
|
|
Logged
|
|
|
|
PBrennick
Never be satisfied
Member
    
Gender: 
Posts: 2083
Never under-estimate the power of an idea
|
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
|
|
|
|
|
farrier
|
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
|
|
|
|
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: 
Posts: 4240
|
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
|
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
|
Nice work Michael  XP Pro (no SP's), no problems found, works like a charm.
|
|
|
|
|
Logged
|
|
|
|
|
Timbo
|
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
|
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). ;-- 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: 
Posts: 4240
|
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
|
Michael,
in attached file is a list with indexes. Not well formatted, but it helped me....
Regards, Phoenix
|
|
|
|
Logged
|
Go the extra mile. It's never crowded...
|
|
|
|
|
Pages: [1] 2
|
|
|
 |