简体   繁体   English

Powershell 将 cpu 利用率转换为百分比的命令

[英]Powershell command for converting the cpu utilization to percentage

Get-Process -Name(particular).* | Get-Process -Name(特定).* | Format-Table -Property ProcessName,CPU格式表-Property ProcessName,CPU

Get-Process -Name cbft.* |获取进程名称 cbft.* | select -Property ProcessName,CPU | select -Property ProcessName,CPU | Sort-Object CPU -Descending排序对象 CPU -降序

please help how to convert the CPU utilization to percentage请帮助如何将CPU利用率转换为百分比

Please share the PowerShell command for covert CPU utilization to percentage请分享 PowerShell 命令以将 CPU 利用率隐藏到百分比

Try the following:尝试以下操作:

$ProcessName = “process_name”
$CpuCores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors
$Samples = (Get-Counter “\Process($Processname*)\% Processor 
Time”).CounterSamples
$Samples | Select InstanceName,
@{Name=”CPU %”;Expression={[Decimal]::Round(($_.CookedValue / $CpuCores), 2)}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM