0
A
回答
-1
Get-Process -Name PowerShell | Select CPU
這是你要找的嗎? 或更多的監測基礎?
param
(
[String]
[Parameter(Mandatory)]
$Title
)
do
{
$process = Get-Process -Name $Title
$process
Start-Sleep -Seconds 1
} while ($process)
+0
'Get-Process'給出了進程擁有的處理器時間量在所有處理器上使用,我不是在尋找這個。我想要CPU使用率%。 – galahad
0
這是正確的答案是支持的情況下,那麼你必須用相同的名字https://stackoverflow.com/a/34844682/483997
# To get the PID of the process (this will give you the first occurrance if multiple matches)
$proc_pid = (get-process "slack").Id[0]
# To match the CPU usage to for example Process Explorer you need to divide by the number of cores
$cpu_cores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors
# This is to find the exact counter path, as you might have multiple processes with the same name
$proc_path = ((Get-Counter "\Process(*)\ID Process").CounterSamples | ? {$_.RawValue -eq $proc_pid}).Path
# We now get the CPU percentage
$prod_percentage_cpu = [Math]::Round(((Get-Counter ($proc_path -replace "\\id process$","\% Processor Time")).CounterSamples.CookedValue)/$cpu_cores)
-1
獲取進程-Name系統中的多個PROCESSS |選擇CPU
以(cpu2-cpu1)/(t2-t1)* 100獲取2實例的CPU時間。你會得到%的CPU值。
相關問題
- 1. 如何在Linux中獲取特定進程的CPU利用率
- 2. C#從特定進程(性能計數器)獲取CPU和RAM
- 3. PowerShell進程CPU檢查
- 4. 獲取PowerShell進程的進程ID
- 5. 使用C++獲取一個進程的cpu使用(win32)
- 6. Powershell獲取進程查詢
- 7. Bash腳本檢查特定進程的CPU使用情況
- 8. 獲取當前進程的CPU使用率用C
- 9. PHP:獲取特定進程的PID
- 10. 獲取特定運行PHP腳本的CPU使用情況
- 11. 獲取CPU使用率最高的進程
- 12. Powershell獲取特定VM的私有IP
- 13. 獲得進程的CPU使用量進程ID
- 14. 如何使用powershell獲取特定的xml元素?
- 15. 如何獲取特定進程的進程ID?
- 16. Linux/Bash,使用ps -o按特定名稱獲取進程?
- 17. PowerShell的:獲取有關獲取,處理,物業CPU
- 18. PowerShell - 獲取被調用應用程序的進程ID
- 19. 獲取使用PowerShell
- 20. 使用PowerShell和Invoke-Webrequest獲取特定信息
- 21. 使用WMI獲取C#中每個進程的CPU和RAM使用情況?
- 22. PowerShell的:獲取ACL,並獲得遠程文件夾對特定用戶權限
- 23. 使用PowerShell獲取進程位置路徑
- 24. 獲取子進程的CPU(用戶和系統)和實際使用時間C
- 25. 在C中檢測特定進程的CPU體系結構#
- 26. 在CodeMirror中獲取特定行中使用的縮進
- 27. 獲取正在運行的進程的列表,並殺死特定的進程
- 28. PowerShell的內存和CPU使用率
- 29. 使用Jquery獲取特定的div
- 30. 使用javascript獲取特定的json值
請參閱[如何在PowerShell腳本中獲取特定進程的CPU使用率和內存消耗](https://stackoverflow.com/a/34844682) – wOxxOm
'Get-Process'給出進程使用的處理器時間量在所有處理器上,我不相信這是CPU使用率% – galahad
我的不好。我只是在看第一個答案。得到它了。謝謝 – galahad