如何衡量特定应用发送和接收的数据量?


Answers:


3

有了这个 Mark Russinovich 微软工具

https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

您可以为进程名称或PID创建过滤器 过滤 菜单。 然后去 工具 菜单和 网络摘要

或者

https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview

如果你有powershell概念,并且你想编写自己的工具:

法国:

get-counter "\Processus(firefox*)\Nombre d’octets lus/s" -Continuous | foreach {
    [math]::round((($_.countersamples.cookedvalue | measure -sum).sum / 1KB), 2)
}

英语

get-counter "\Process(firefox*)\IO Read Bytes/sec" -Continuous | foreach {
    [math]::round((($_.countersamples.cookedvalue | measure -sum).sum / 1KB), 2)
}

使用此代码和此循环。创建一个总变量并在每次迭代中分配计算的总和。调整KB,可以是MB,GB ......

将此脚本保存到文件.ps1中,打开 命令提示符 并执行此脚本,(CTRL + C表示停止)

$process="firefox"
$totalKB = 0
while($true){    
    get-counter "\Process($process*)\IO Read Bytes/sec" | foreach {
        $totalKB += [math]::round((($_.countersamples.cookedvalue | measure -sum).sum / 1KB), 2)
    }
    Write-Host -NoNewline -ForegroundColor Yellow ("`r"+$process.ToUpper()+": "+([string]$totalKB)+" KB    ")
    Start-Sleep -Milliseconds 500
}
write-host

结果(例如,与Linux Watch相同)

FIREFOX:3256 KB

参考:

https://blogs.technet.microsoft.com/heyscriptingguy/2011/01/31/use-powershell-to-simplify-collecting-performance-information/


使用wireshark是一个坏主意,因为一个应用程序可以有多个数据流
Windows11

这是事实,我编辑了我的答案。
f14284
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.