To get the best performance out of Virtual Desktops it is essential that the power configuration in the system BIOS and the HyperVisor are configured for maximum performance.
Many people have blogged about the importance of these settings like, Andrew Wood, Helge Klein and Didier Van Hoye. So I will not go into details again.
But how do you check from a Virtual Machine if you are actually running at full clock speed or not?
I have written a PowerShell script to do just that (requires at least PowerShell v3).
Here are some screenshots:
Running with "High Performance profile":
Running with "Balanced" power profile:
Here is the script (download link at the bottom):
# How many times to query clockspeed
$count = 100
# Interval in ms
$interval = 50;
# Little helper to add colours to output
filter ColorPattern( [string]$Pattern, [ConsoleColor]$Color, [switch]$SimpleMatch ) {
if( $SimpleMatch ) { $Pattern = [regex]::Escape( $Pattern ) }
$split = $_ -split $Pattern
$found = [regex]::Matches( $_, $Pattern, 'IgnoreCase' )
for( $i = 0; $i -lt $split.Count; ++$i ) {
Write-Host $split[$i] -NoNewline
Write-Host $found[$i] -NoNewline -ForegroundColor $Color
}
Write-Host
}
#Get Maximum Clock Speed (once because WMI is slow)
$maxClockSpeed = (get-wmiobject Win32_Processor | select-object -first 1).MaxClockSpeed
#default color
$highlighColor = 'Green'
function GetClockSpeed()
{
$freq = Get-Counter -Counter "\Processor Information(*)\Processor Frequency"
$item = New-Object System.Object
foreach ($cpu in $freq.CounterSamples)
{
$procNum = ([RegEx]::Match($cpu.Path, '.+\((\d+,\d+)\).*')).Groups[1].Value
if ($procNum)
{
$item | Add-Member -Type NoteProperty -Name $procNum -Value $cpu.CookedValue
}
}
$item
}
for ($i=0 ; $i -lt $count ; $i++)
{
$list = GetClockSpeed
cls
$firstCoreSpeed = ($list | Select-Object -ExpandProperty "0,0")
# Just some formatting magic, make it green if full speed and red otherwise
if ($firstCoreSpeed -lt $maxClockSpeed) { $highlighColor = 'Red' } else { $highlighColor = 'Green' }
"Actual: {0} Mhz Maximum: {1} Mhz -> {2:P0}" -f $firstCoreSpeed, $maxClockSpeed, ($firstCoreSpeed / $maxClockSpeed) | ColorPattern -Pattern '\d+ %' -Color $highlighColor
"Speed per Core:"
$list | Format-Table -AutoSize | Out-String | ColorPattern -Pattern '\d\d+' -Color $highlighColor #-SimpleMatch
# Sleep until next interval
Start-Sleep -Milliseconds $interval
}
Like this one, great work Remko!
Unfortunatley this reports only the stock speed on a machine with HyperV enabled. Even with Power Saver set, confirmed with Cpu-Z
You could use HyperV Hypervisor\Logical Processor\Frequency - this is accurate below stock freq but will not report Turbo freq (Win8.1)