Welcome to the final blog in Windows PerfCounters and Powershell
series and sorry for the delay. The purpose of this blog is to
explain the inner workings of top-script.ps1 script and practical
usage of Performance counters on Windows through Powershell. It
is intended for people who want Linux top - like tool on
Windows.
The script is a part of and available in our existing benchmarking package (dbt2-0.37.50.10) developed
by Mikael Ronstrom.
On Top:If you ever did benchmarking on Linux or simply wondered
"where did all my resources go", top is your best friend. Since
this post is not about Linux, you can google "Linux top
explained" for more details.
On Performance counters:To learn about Windows PerfCounters,
please refer to my previous …
In previous blog, I covered DISK/IO counters.
This blog will briefly touch on Network, Threading and
Contention.
Other counters:
Network I/OCOUNTER: Network Interface\Bytes
Total/sec
TYPE: Instantaneous
USAGE:
[Read more]#Get Instances
PS > (New-Object
Diagnostics.PerformanceCounterCategory
("Network Interface"
)).GetInstanceNames
(""
)
Intel[R] Centrino[R] Advanced-N 6205
Microsoft Virtual WiFi Miniport Adapter _2
Microsoft Virtual WiFi Miniport Adapter
Intel[R] 82579LM Gigabit Network Connection
PS >New-Object
Diagnostics.PerformanceCounter
("Network Interface",
)
"Bytes Total/sec", "Intel[R] 82579LM Gigabit Network Connection"
CategoryName …
This post is the hardest for me to write as I generally pay
little attention to disks. When they prove too slow, I replace
them with faster ones. So now I am writing this on laptop with
two SSDs. That said, Disk subsystem could be a major system
performance bottleneck and thus there are numerous counters
covering this area (Get-CimClass *disk* | Select
CimClassName
). I would also like to turn your attention to
old yet excellent article Top Six FAQs on Windows 2000 Disk Performance
if you're interested in subject.
Disk counters:Note: Microsoft recommends that "when attempting to
analyse disk performance bottlenecks, you should always use
physical disk counters. However, if you use software RAID, you
should use logical disk counters. As for Logical Disk and
Physical Disk Counters, the same values are available in each of
these …
In the last blog I spoke of CPU counters. Now,
I'll talk of Memory counters.
MEMORY Counters (CIM_PhysicalMemory class, Win32_PerfFormattedData_PerfOS_Memory class,
Memory Performance Information ...): Note: I
introduced the notion of samples and how to fetch them using
NextValue() so I will occasionally omit $var.NextValue() going
forward.
Let me note here that if you thought previously described
performance classes were complicated, you are now entering the
realm of black magic ;-) There is a good …
So far, I talked of WMI, CIM, WQL,
System.Diagnostics.PerformanceCounterCategory, perf-counter data
organization and flavour. Now it's time to look at some
performance counters I deem important for my use-case more
closely.
Note: List of available Counters for Get-Counter command
Get-Counter -ListSet * | Sort-Object CounterSetName |
Format-Table CounterSetName
Basic concepts:I will introduce basic concepts of Processor, Core
and CPU now to help you follow the text. Let us use this
convention:
- "Processor" is a piece of hardware you connect to a slot on the motherboard.
- "Physical Core" is a physical computing unit built into the "Processor".
- "Virtual Core" is a virtual computing unit built on top of "Physical Core" (i.e. HT is ON).
- "CPU" is a computing unit inside the "Processor", either physical or virtual.
…
Summary from last blog:
- Tip: An alias for Get-CimInstance is GCim, for Select-Object it's Select and for Get-WmiObject is GWmi.
- There are Raw and Formatted counters. Watch out for formula converting Raw samples to Formatted values.
NAMESPACE organizationThe general organization of namespaces is
as follows:
Category (Class if you prefer)
Counter(s)
Instance(s)
Every Category has Counters but not all of the Counters have
Instances. The full path to the desired value is called a
__PATH:
PS >[Read more]GWmi
Win32_PerfFormattedData_PerfOS_Processor |Select
__Path
__PATH
------
namespace …
How to interpret Raw data from Windows performance
counters.
Tip: An alias for Get-CimInstance is GCim and
alias for Get-WmiObject is GWmi.
In the first blog post, I covered what WMI/CIM is and
how to get info from there. Last I talked about was RawData
counters:
Get-CimInstance -Class
Win32_PerfRawData_PerfOS_Processor
Name : _Total
...
PercentIdleTime : 78061457390
Understanding RawData:By itself, a RawData value is a sample but
important thing is to determine what concrete sample value
actually is and how to convert it to a form we understand. In
this example, MSDN tells us PercentIdleTime is a counter of
type 542180608:
…
In this series of blogs, I will cover Windows performance
counters infrastructure, collecting and interpreting the data
and, in final blog, provide the Powershell script built on this.
I should note that I am very new to Powershell so take my
empirical findings with grain of salt. Also, coming from Linux
bash, I found Powershell confusing at first but, after getting
comfortable with concept of passing Objects down the pipe, I have
to say I like it a lot.
It all starts in WDM framework (Windows Driver Model) where metrics is
collected for WMI-for-WDM enabled device drivers. The classes
created by the WDM provider to represent device driver data
reside in the "Root\WMI" namespace. I will talk of namespaces
shortly.
So, the WDM provider records information about WDM operations in
the …
We make a lot of posts that give IT tips and advice, as well as recommendations on how to use Monitis, so here is a summary of the posts for this week in case you missed them.
Monitoring IIS With VBScript via Monitis; It’s so Easy!
This post demonstrates how to monitor an IIS using Monitis Custom Monitors and VBscript. You can use the Monitis API to monitor your own custom metrics. This is very powerful because it lets you monitor any IIS metrics you like, set thresholds and receive notifications.
Top 4 Software Based IIS Server Performance Tips
These 4 …
[Read more]