♻️ Approach
As mentioned here^2:
This API will tell you total number of I/O operations as well as total bytes.
You can call GetProcessIoCounters to get overall disk I/O data per process - you'll need to keep track of deltas and converting to time-based rate yourself.
So, based on this C# tutorial you could do something along those lines:
struct IO_COUNTERS
{
public ulong ReadOperationCount;
public ulong WriteOperationCount;
public ulong OtherOperationCount;
public ulong ReadTransferCount;
public ulong WriteTransferCount;
public ulong OtherTransferCount;
}
[DllImport("kernel32.dll")]
private static extern bool GetProcessIoCounters(IntPtr ProcessHandle, out IO_COUNTERS IoCounters);
public static void Main()
{
IO_COUNTERS counters;
Process[] processes = Process.GetProcesses();
foreach(Process process In processes)
{
try {
GetProcessIoCounters(process.Handle, out counters);
console.WriteLine("\"" + process.ProcessName + " \"" + " process has read " + counters.ReadTransferCount.ToString("N0") + "bytes of data.");
} catch (System.ComponentModel.Win32Exception ex) {
}
}
console.ReadKey();
}
Use this to convert it to VB.NET
But (System.ComponentModel.Win32Exception ex) occurs
System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
at System.Diagnostics.Process.OpenProcessHandle(Int32 access)
at System.Diagnostics.Process.get_Handle()
at taskviewerdisktest.Form1.Main() in C:\...\source\repos\taskviewerdisktest\taskviewerdisktest\Form1.vb:line 32
Some processes seem to be really hard to access.. good news is that not many of them tho in my case (15 out of 250 or something) ..
⚠️ Disclaimer: this is more like an aproach towards "The solution" rather than "The solution"
♻️ Other Approaches & References