Welcome, Sit down, and make yourself comfortable.
Published on May 22, 2006 By RomanDA In DesktopX
Is there a way with DX to show an flashing light or something that would show when the hard drive is being written to or read from?
IE: Any Hard Drive Activity?

If this is already out there please forgive me, im just having some issue and wanted to see if i could monitor the hard drive activity.

thanks.

Comments
on Jul 13, 2006
I found your question while searching for an answer to the same need. I found this:

Diskmon

This is a free utility from Sysinternals, some of the best utilities can be found there. Turn off the logging and hit ctrl-m to put it in the tray.
on Jul 13, 2006
Thanks! I was hoping to just make something simple in DX that i could customize.
on Jul 13, 2006
Roman,
Try creating a performance meter object. Set the Data Source as a System Performance Meter. Change the Performance Object to to Physical Disk, and select %Disk Time from the counters list.

I'm not 100 percent sure of the accuracy of that, but it's a starting point.

I set one to monitor my C drive and ran disk defragmenter. I seemed to be working for me without doing any customization on the object. I just set it as a horizontal bar with 30x30 dimensions.
on Jul 13, 2006
phoon,

VERY kewl.. will try it out.
on Jul 13, 2006
That was a VERY cool Idea by the way!!  
on Jul 13, 2006
Hey Roman. The answer is maybe. There is a Procedure in VB as follows:

The Drive object provides access to the various properties of the local or remote disk drive.

The following code uses the GetDrive method of the FileSystemObject object to get the Drive object for drive "c".

Code:

"Set filesys = CreateObject("Scripting.FileSystemObject")
Set drv = filesys.GetDrive("c")
Set Drivestate = drv.object.IsReady


Look at the IsReady property listed below.

PROPERTIES

AvailableSpace Property
Returns the amount of space available on the specified local or remote disk drive.

Syntax: object.AvailableSpace

DriveLetter Property
Returns the dirve letter of the specified local or remote disk drive. Read only.

Syntax: object.DriveLetter

DriveType Property
Returns an integer indicating the type of the drive.

Syntax: object.DriveType

FileSystem Property
This property returns the file system type that is in use on the specified drive.

Syntax: object.FileSystem

FreeSpace Property
Returns the amount of free space available to a user on the specified local or remote drive.

Syntax: object.FreeSpace

IsReady Property
This property is a Boolean whose value is True if the specified drive is available for use and False otherwise.

Syntax: object.IsReady

Path Property
Returns the path for a specified file, folder or drive.
Syntax: object.Path

RootFolder Property
Returns a Folder object that represents the root folder of the specified drive.

Syntax: object.RootFolder

SerialNumberProperty
Returns the decimal serial number for the specified drive. This number can be used to uniquely identify a disk volume.

Syntax: object.SerialNumber

ShareName Property
Returns the network name in Universal Naming Convention (UNC) for the remote disk drive. Used only when working with a remote drive (DriveType property is 3).

Syntax: object.ShareName

TotalSize Property
Returns the total space, in bytes, of the specified drive.

Syntax: object.TotalSize

VolumeName Property
Sets or returns the volume name of the specified drive.

Syntax: object. VolumeName [ = newname]

Please notice above the IsReady property. Whenever the drive is reading or writing the above property will be false. Whenever the drive is inactive IsReady will be true.


Based on the above code you could then create an object whose state would change based on the above created boolean value of Drivestate.
This should work 100% in DesktopX. I hope that helps.

on Jul 14, 2006
The only problem with that approach BigDogBigFeet, is that the only way to update the status of the object would be in a busy loop or by using a sleep statement that only sleeps for 1ms at a time, which would essentially turn into a busy loop. With Phoon's approach I'd imagine the System Performance Meter code registers itself as a listener for the requested event so it is notified of state changes by the OS as opposed to having to poll for changes. It may not turn out to be a drag on performance to poll for the change but it's almost assuredly going to use quite a bit of CPU time.
on Jul 14, 2006
I hear ya, but I've tried similar stuff before and no its not a big drain on the CPU. If you poll once every 1/2 sec. or even 1/4 second, the cpu barely flinches. Besides the method I mention allows you to create an object that is a small green light when available and a small red light when active. You can create a Disk Icon with a small green light and when disc activity occurs it changes to red. How many analogue clocks can you place on your desktop at one time 3, 4 its no problem. All the second hands will be updated easily. But if you want a horizontal or vertical bar graph for a disk activity light, well then, Phoon's method will do that. The only problem I know of with my approach is getting the VB script right, when done right it should work well.
on Jul 14, 2006
The meter method can also monitor partition activity if one selects the Logical Disk Performance Object, %Disk Time, and your partition on the right.

I am unfamiliar with how DX handles these meters. Is there a way to access the values, or can we only display the graphs available by default?

If the values can be accessed from a script, a closer approximation to an activity light could be made. Judge averages the percentage over a period of time, and returns values analagous to inactive, somewhat active, fully active, in his script for the Active Disk docklet. Which I used with permisssion and a some degree of success in my Blister Pack.

With that shameless plug out of the way, how do these meters work? Can we access them directly via script or do we need a dll type interface as provided by SysStats or the DX Meters Plug-In? BigDog's approach seems to have quite a bit of potential.