I am trying to do some benchmarks on local database management systems. I need to come up with a GUI that will show information like
- cpu usage of each core
- memory usage
- HDD I/O
- ..etc
It will be without the use of Vb.net but i can use p/invoke or native code if needed
Following code is: as far as I could get information
Set objCimv2 = GetObject("winmgmts:root\cimv2")
Set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
' Add items to the SWbemRefresher
' Without the SWbemRefreshableItem.ObjectSet call,
' the script will fail
Set objMemory = objRefresher.AddEnum _
(objCimv2, _
"Win32_PerfFormattedData_PerfOS_Memory").ObjectSet
Set objDiskQueue = objRefresher.AddEnum _
(objCimv2, _
"Win32_PerfFormattedData_PerfDisk_LogicalDisk").ObjectSet
Set objQueueLength = objRefresher.AddEnum _
(objCimv2, _
"Win32_PerfFormattedData_PerfNet_ServerWorkQueues").ObjectSet
' Initial refresh needed to get baseline values
objRefresher.Refresh
intTotalHealth = 0
' Do three refreshes to get data
For i = 1 to 3
WScript.Echo "Refresh " & i
For each intAvailableBytes in objMemory
WScript.Echo "Available megabytes of memory: " _
& intAvailableBytes.AvailableMBytes
If intAvailableBytes.AvailableMBytes < 4 Then
intTotalHealth = intTotalHealth + 1
End If
Next
For each intDiskQueue in objDiskQueue
WScript.Echo "Current disk queue length " & "Name: " _
& intDiskQueue.Name & ":" _
& intDiskQueue.CurrentDiskQueueLength
If intDiskQueue.CurrentDiskQueueLength > 2 Then
intTotalHealth = intTotalHealth + 1
End If
Next
For each intServerQueueLength in objQueueLength
WScript.Echo "Server work queue length: " _
& intServerQueueLength.QueueLength
If intServerQueueLength.QueueLength > 4 Then
intTotalHealth = intTotalHealth + 1
End If
Wscript.Echo " "
Next
If intTotalHealth > 0 Then
Wscript.Echo "Unhealthy."
Else
Wscript.Echo "Healthy."
End If
intTotalHealth = 0
Wscript.Sleep 5000
' Refresh data for all objects in the collection
objRefresher.Refresh
Next
I am looking for a nice API to access real time hardware (current version is windows 7 x64) information and statistics using C#, asp.net webforms, framework 4.0 - 4.02 . For now all I know is how to manipulate and access `Processes' but not bind as required in this post.