What is “cooked value” returning in Powershell's get-counters cmdlet?

柔情痞子 提交于 2021-01-27 04:08:10

问题


I'm using Powershell to return values for certain performance counters, and I'm seeing that it is referring to "Cookedvalues" when presenting the information. I'm looking for each counter hit to be reported on it's own, so I can do analysis like seeing the 90th percentile values or max/min, so I need to know how it is arriving at Cooked Value. Here is the code I am currently working with:

$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:


According to https://blogs.technet.com/b/nexthop/archive/2011/06/02/gpsperfcounters.aspx, a "CookedValue" is:

performance counters typically have raw values, second values, and cooked values. The raw values and second values are the raw ingredients used by the performance counter, and the "cooked value" is the result of "cooking" those ingredients into something for human consumption.

So apparently the CookedValue is the result of combining the counter's raw data to get a usable value that you can understand and work with.



来源:https://stackoverflow.com/questions/16223648/what-is-cooked-value-returning-in-powershells-get-counters-cmdlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!