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. Powershell獲取具有ID進程的特定進程計數器
- 2. 如何在Linux中獲取特定進程的CPU利用率
- 3. 定期提取特定進程的CPU使用情況
- 4. 獲取進程Cpu的使用在c
- 5. C#從特定進程(性能計數器)獲取CPU和RAM
- 6. 如何使用PowerShell獲取CRM進程?
- 7. PowerShell進程CPU檢查
- 8. 獲取PowerShell進程的進程ID
- 9. Powershell獲取CPU百分比
- 10. 使用C++獲取一個進程的cpu使用(win32)
- 11. Powershell獲取進程查詢
- 12. 如何獲得CPU使用率和內存的特定進程在PowerShell腳本消耗
- 13. Bash腳本檢查特定進程的CPU使用情況
- 14. 記錄特定進程每分鐘的CPU使用情況
- 15. 獲取當前進程的CPU使用率用C
- 16. 如何使用Powershell來殺死特定進程ID的線程
- 17. PHP:獲取特定進程的PID
- 18. 獲取特定運行PHP腳本的CPU使用情況
- 19. 從wmi獲取每個進程的CPU使用情況
- 20. 獲取CPU使用率最高的進程
- 21. Powershell獲取特定VM的私有IP
- 22. 獲得進程的CPU使用量進程ID
- 23. 獲取Linux進程資源使用情況(CPU,磁盤,網絡)
- 24. 如何使用powershell獲取特定的xml元素?
- 25. 如何獲取特定進程的進程ID?
- 26. Linux/Bash,使用ps -o按特定名稱獲取進程?
- 27. 如何在容器上的特定進程上獲取RAM,CPU和網絡使用情況
- 28. PowerShell的:獲取有關獲取,處理,物業CPU
- 29. PowerShell - 獲取被調用應用程序的進程ID
- 30. 使用WMI從系統獲取進程列表,使用CPU使用率> 90%
請參閱[如何在PowerShell腳本中獲取特定進程的CPU使用率和內存消耗](https://stackoverflow.com/a/34844682) – wOxxOm
'Get-Process'給出進程使用的處理器時間量在所有處理器上,我不相信這是CPU使用率% – galahad
我的不好。我只是在看第一個答案。得到它了。謝謝 – galahad