Created
August 2, 2017 21:04
-
-
Save aadennis/514b5f9ffee579c803ae9820fdc7a76b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflow Invoke-PerfCounter { | |
param($counters) | |
foreach -parallel ($counter in $counters) { | |
(Get-Counter $counter).CounterSamples | | |
Select -Property Path, CookedValue } } | |
$counters = | |
'\Processor(*)\% Processor Time', | |
'\Processor(*)\% User Time', | |
'\Process(*)\Handle Count', | |
'\Process(*)\IO Read Operations/sec', | |
'\Process(*)\IO Write Operations/sec', | |
'\Process(*)\IO Data Operations/sec' | |
$start = Get-Date | |
Invoke-PerfCounter $counters | .\clip.exe | |
$end = Get-Date | |
$start | |
$end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$computer = $ENV:Computername | |
$instance = "_total" | |
# Disk counters... | |
@("\\$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 | |
# CPU counters | |
$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 | |
# Memory counters | |
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment