Sign in to follow this  
Followers 0
koresho

Determine process latency

4 posts in this topic

#1 ·  Posted (edited)

Hello all,

In Windows 7, you can use the Resource Monitor's Network tab to find the latency of any process that is using the network.

I would like to gather that information.

Is there a way that anyone knows of to access whatever the Resource Monitor is using to pull that information?

Even if I have to check latency myself, what method does the Resource Monitor use to learn the round trip time of the data?

Thanks for any help.

Edited by koresho

Share this post


Link to post
Share on other sites



There might be something along those lines in Ascend4nt's Performance Counters in Windows - Measure CPU,Disk,Network etc Performance. Your gonna have to do some reading though as there is a lot of counters.

Share this post


Link to post
Share on other sites

Ah, that looks like it's perfect!

Thanks very much.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

So, I've not had a chance to come back to this project until now, and after looking through Ascend4nt's UDF (which is very thorough!) I seem to be missing the one thing I'm after: The latency of a process.

Maybe I'm simply overlooking it; if so I apologize for wasting anyone's time- however I've looked through all the supplied examples and don't see anything, even in the supplied "TestPDH_PerformanceCounters.au3" which seems to be an overview of all the functions that the UDF supports.

If anyone has any ideas, or a way that I can use Ascend4nt's code as a base and extend it, I'd appreciate the help.

Edit:

Figured out a workaround. If someone has something to add, feel free- but here's what I did, in case people search for this in the future like I did. Basically, I scraped the Windows 7 Resource Monitor for the data.

Note: This only works on Windows 7 for sure, still testing for Vista.

Func _getStats() ;get the stats of the process latency
If TimerDiff($time) < GUICtrlRead($refreshRate) Then Return
If ProcessExists("process.exe") = 0 Then ;if the process doesn't exist, report it
  _update("Process isn't running!")
  Return ;return to the main loop
Else
  $hWnd = ControlGetHandle ("Resource Monitor", "", "[CLASS:SysListView32; INSTANCE:15]" ); to get handle of listview
  $itemCount = _GUICtrlListView_GetItemCount($hWnd)
  For $i = 0 To $itemCount
   $text[$i] = _GUICtrlListView_GetItemText($hWnd, $i); Loop to get the contents of the list view
;~   _log($text[$i])
   If StringInStr($text[$i], "Process.exe") Then
    $ping = _GUICtrlListView_GetItemText($hWnd, $i, 6) ;get latency column
    If $ping = "-" Then
     _update("Connection idle")
    Else
     _log($text[$i] & " " & $ping)
     _update("Process.exe: " & $ping& "ms (Averaged)")
    EndIf
   EndIf
  Next
EndIf
;at end
$time = TimerInit()
EndFunc

Func _startUpPerfmon()
If WinExists("Resource Monitor") = 0 Then
  FileInstall(".Default.ResmonCfg", @TempDir & "Default.ResmonCfg", 1)
  ShellExecute(@TempDir & "Default.ResmonCfg", "", "", "open", @SW_HIDE)
  WinWaitActive("Resource Monitor") ;just launching caused the window to lose focus, this gives it back
  WinActivate($title)
EndIf
EndFunc
Edited by koresho

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0