Powershell Count上下文切换

时间:2015-03-31 09:48:38

标签: powershell context-switch

我正在尝试在PowerShell中显示一秒钟内的上下文切换次数。到目前为止,我一直在尝试Get-Counter -Counter "System\Context Switches/sec"同时使用“”和“”,两者都会导致错误:

Get-Counter : Internal performance counter API call failed. Error: c0bc4

我知道perfmon展示这个的能力,我需要它在Powershell中显示为文本。

4 个答案:

答案 0 :(得分:2)

你错过了领先的\。这将有效:

get-counter -Counter "\System\Context Switches/sec"

答案 1 :(得分:2)

Geeze,我刚刚意识到这些命令是特定于语言的。我的挪威语系统只接受挪威语命令。这样就解决了我的问题!

挪威指挥:Get-Counter -Counter "\System\Kontekstvekslinger/sek"

答案 2 :(得分:1)

尝试将计算机名称放在路径中。

get-counter -Counter "\\<computer-name>\System\Context Switches/sec"

尽管archo444的答案应该有效。

答案 3 :(得分:0)

$All = Get-Counter -ListSet * | ForEach-Object -Process { $PSItem.Paths; $PSItem.PathsWithInstances; }

get-counter -Counter ($All | Select-String -Pattern "context" )

我得到的错误与你一样,我尝试这样做并获得结果

相关问题