Powershell get-counters cmdlet中返回的“熟值”是什么?

时间:2013-04-25 19:57:24

标签: powershell performancecounter

我使用Powershell返回某些性能指标的值,我发现它指的是" Cookedvalues"在提供信息时。我正在寻找报告它自己的每个计数器,所以我可以做分析,比如看到第90个百分位值或最大/最小值,所以我需要知道它是如何达到熟食值的。以下是我目前正在使用的代码:

$computer         = $ENV:Computername 
$instance         = "_total" 

@("\\$Computer\PhysicalDisk(*)\Current Disk Queue Length", 
  "\\$Computer\PhysicalDisk(*)\% Disk Time", 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk Queue Length", 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk Read Queue Length", 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk Write Queue Length", 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk sec/Transfer" 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk sec/Read", 
  "\\$Computer\PhysicalDisk(*)\Avg. Disk sec/Write") |% { 
    (Get-Counter $_.replace("*",$instance)).CounterSamples } | 
    Select-Object Path,CookedValue | 
    Format-Table -AutoSize 


#   Retrieve the current Processor performance counter information. 
$computer         = $ENV:Computername 
$instance         = "_total" 
@("\\$Computer\Processor(*)\% Processor Time", 
  "\\$Computer\Processor(*)\% User Time", 
  "\\$Computer\Processor(*)\% Privileged Time", 
  "\\$Computer\Processor(*)\Interrupts/sec", 
  "\\$Computer\Processor(*)\% DPC Time", 
  "\\$Computer\Processor(*)\DPCs Queued/sec" 
  "\\$Computer\Processor(*)\% Idle Time", 
  "\\$Computer\Processor(*)\% Interrupt Time") |% { 
    (Get-Counter $_.replace("*",$instance)).CounterSamples } | 
    Select-Object Path,CookedValue | 
    Format-Table -AutoSize 

# Retreive the current Memory counter information 
$computer         = $ENV:Computername 
$instance         = "_total" 
@("\\$Computer\Memory\Page Faults/sec", 
  "\\$Computer\Memory\Available Bytes", 
  "\\$Computer\Memory\Committed Bytes", 
  "\\$Computer\Memory\Commit Limit", 
  "\\$Computer\Memory\Pages/sec", 
  "\\$Computer\Memory\Free System Page Table Entries" 
  "\\$Computer\Memory\Pool Paged Resident Bytes", 
  "\\$Computer\Memory\Available MBytes") |% { 
    (Get-Counter $_.replace("*",$instance)).CounterSamples } | 
    Select-Object Path,CookedValue | 
    Format-Table -AutoSize 

1 个答案:

答案 0 :(得分:7)

根据https://blogs.technet.com/b/nexthop/archive/2011/06/02/gpsperfcounters.aspx,“CookedValue”是:

  

性能计数器通常具有原始值,第二个值和熟值。原始值和第二个值是性能计数器使用的原料,“熟食值”是将这些成分“烹饪”成人类消费的结果。

显然,CookedValue是将计数器的原始数据组合在一起以获得您可以理解和使用的可用值的结果。