powershell - powershell中代码块的cpu使用情况

标签 powershell

我试图让 Powershell 给我一个代码块的平均 CPU 使用率,但无法弄清楚要使用什么 wmi 类。

这只给了我当前的用法:

Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average

最佳答案

使用的类将返回 CPU 级别的数据。试试看process level以获得更细粒度的数字。

成员(member)UserModeTime包含进程的 CPU 时间使用情况。将其转换为更易读的值的一种简单方法是使用 TimeSpan像这样,[TimeSpan]::FromMilliseconds()

关于powershell - powershell中代码块的cpu使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25723087/

相关文章:

Powershell 缩进此处字符串

powershell - 从 WiX 静默执行 PowerShell 脚本挂起 PowerShell

powershell - 如何使用 Windows PowerShell 从 MariaDB 转储文件导入数据

delphi - Delphi 的 PowerShell 自动化?

sql - 从 CSV 文件批量插入到远程服务器中的表

powershell - XDELETE 不删除 ElasticSearch 中的索引

powershell - SMTP 的安全连接

sharepoint - 无法使用Sharepoint PowerShell更新列表字段属性

windows - 使用 PowerShell 重置 'Friendly Name' 证书属性

powershell - Get-ChildItem 的作用类似于 ls 而不是 ls -l