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