javascript - Kill Process in windows when the download speed drops -


i looking code in instance powershell/cmd kill process when download speed goes below 5 mbps.

the situation using vlc mediaplayer live broadcasting. happens broadcast goes down or starts having hickups.

the solution restart. restart when complains not being able connect.

i looking script/code monitor process , automatically restart/kill when download speed goes below level or isn't consistent.

implying vlc reads content disk , speed matches outbound network speed can use disk read speed process performance counter measured 1 second:

@echo off setlocal enabledelayedexpansion  set limit=500000 set process=vlc  :loop set line=0 /f "delims=, tokens=2" %%a in ('typeperf -sc 1 "\process(%process%)\io read bytes/sec"') (     set /a line+=1     if !line!==2 (         set speed=%%a         set speed=!speed:"=!         /f "delims=. tokens=1" %%b in ("!speed!") set speed=%%b         if !speed! lss %limit% (             taskkill /f /im %process%.exe             call run-vlc.bat         )     ) ) goto loop 

assuming 5mbps 500kbps limit set accordingly 500000.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -