When collecting perf counter data in PowerShell, you need to be aware of the type of counters you are collecting data from. Looking at the "avg_latency" counter, we see the BaseCounter is "total_ops".
[3.0] 10.61.167.254> Get-NcPerfCounter -Name volume | ? { $_.Name -eq "avg_latency" }
AggregationStyle :
BaseCounter : total_ops
Desc : Average latency in microseconds for the WAFL filesystem to process all the operations on the
volume; not including request processing or network communication time
IsKey :
Labels :
Name : avg_latency
NcController : 10.61.167.254
PrivilegeLevel : basic
Properties : average
TranslationInputCounter :
Type :
Unit : microsec
IsKeySpecified : False
With this information, we know that we can calculate the avg_latency value (in microseconds) by reading the values of the avg_latency and total_ops counters twice (separated by some time), then do the calculation:
(avg_latency[1] - avg_latency[0]) / (total_ops[1] - total_ops[0])
Where avg_latency[0] and total_ops[0] are the values from the first reading and avg_latency[1] and total_ops[1] are the values from the second reading.
Here is some rough PowerShell code (you can probably clean up pulling the data values from the CounterData):
[3.0] 10.61.167.254> $perfdata1 = Get-NcPerfData -Name volume -InstanceUuid 3e964011-7259-11dc-a5ef-123478563412 -Counter avg_latency, total_ops
(wait a few seconds...)
[3.0] 10.61.167.254> $perfdata2 = Get-NcPerfData -Name volume -InstanceUuid 3e964011-7259-11dc-a5ef-123478563412 -Counter avg_latency, total_ops
[3.0] 10.61.167.254> $avg_latency = @( ($perfdata1.Counters | ? { $_.Name -eq 'avg_latency' }).Value, ($perfdata2.Counters | ? {$_.Name -eq 'avg_latency' } ).Value )
[3.0] 10.61.167.254> $total_ops = @( ($perfdata1.Counters | ? { $_.Name -eq 'total_ops'}).Value, ($perfdata2.Counters | ? {$_.Name -eq 'total_ops'} ).Value )
[3.0] 10.61.167.254> ($avg_latency[1] - $avg_latency[0]) / ($total_ops[1] - $total_ops[0])
48.2258064516129
Also, check out the Invoke-NcSysstat cmdlet which will give you a value for the avg_latency counter in the form of a .NET TimeSpan object:
[3.0] 10.61.167.254> Invoke-NcSysstat -Volume clusterdisks -Count 5 | select Name, TotalLatency
Name TotalLatency
---- ------------
clusterdisks 00:00:00.0001083
clusterdisks 00:00:00.0001850
clusterdisks 00:00:00.0000703
clusterdisks 00:00:00.0000268
clusterdisks 00:00:00.0001520
-Steven