Skip to content

Commit 209d312

Browse files
author
Dan Lovinger
committed
update watch-cpu to provide normalized cpu utility summary
sweep-cputarget now gathers average csvfs latencies
1 parent ae284a6 commit 209d312

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

Frameworks/VMFleet/s2d-vmfleet.docx

3.14 KB
Binary file not shown.

Frameworks/VMFleet/s2d-vmfleet.pdf

-128 KB
Binary file not shown.

Frameworks/VMFleet/sweep-cputarget.ps1

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ $qoswindow = 5
4242

4343
# clean result file and set column headers
4444
del -Force $outfile -ErrorAction SilentlyContinue
45-
'WriteRatio','QOS','AVCPU','IOPS' -join "`t" > $outfile
45+
'WriteRatio','QOS','AVCPU','IOPS','AVRLat','AVWLat' -join "`t" > $outfile
4646

4747
# make qos policy and reset
4848
Get-StorageQosPolicy -Name SweepQos -ErrorAction SilentlyContinue | Remove-StorageQosPolicy -Confirm:$false
@@ -73,6 +73,13 @@ function get-pc(
7373
($pc[$t0 .. $t1].CounterSamples.CookedValue | measure -Average).Average
7474
}
7575

76+
$pc = @('\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time',
77+
'\Processor Information(_Total)\% Processor Performance',
78+
'\Cluster CSVFS(_Total)\reads/sec',
79+
'\Cluster CSVFS(_Total)\avg. sec/read',
80+
'\Cluster CSVFS(_Total)\writes/sec',
81+
'\Cluster CSVFS(_Total)\avg. sec/write')
82+
7683
# limit the number of attempts per sweep (mix) to 4 per targeted cpu util
7784
$sweeplimit = ($cputargets.count * 4)
7885

@@ -102,10 +109,11 @@ foreach ($w in 0,10,30) {
102109
write-host -fore Cyan Starting loop with QoS target $qos
103110

104111
$curaddspec = "$($addspec)w$($w)qos$qos"
105-
start-sweep.ps1 -addspec $curaddspec -b 4 -o 32 -t 1 -w $w -p r -d 60 -warm 15 -cool 15 -pc '\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time','\Processor Information(_Total)\% Processor Performance'
112+
start-sweep.ps1 -addspec $curaddspec -b 4 -o 32 -t 1 -w $w -p r -d 60 -warm 15 -cool 15 -pc $pc
106113

107114
# HACKHACK bounce collect
108-
Get-ClusterSharedVolume |? { $_.SharedVolumeInfo.FriendlyVolumeName -match 'collect' } | Move-ClusterSharedVolume
115+
Get-ClusterSharedVolume |? { $_.SharedVolumeInfo.FriendlyVolumeName -match 'collect' } | Move-ClusterSharedVolume
116+
sleep 1
109117

110118
# get average IOPS at DISKSPD
111119

@@ -123,10 +131,37 @@ foreach ($w in 0,10,30) {
123131
$trt = get-pc $_ $center '\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time'
124132
$ppc = get-pc $_ $center '\Processor Information(_Total)\% Processor Performance'
125133
$trt*$ppc/100
134+
135+
126136
} | measure -Average).Average
127137

138+
# get average latency for central 60 seconds, all nodes
139+
# note we must aggregate the product of av latency and iops per node to get total
140+
# latency, and then divide by total iops to get whole-cluster average.
141+
142+
$csvrtotal = 0
143+
$csvwtotal = 0
144+
145+
($avrlat,$avwlat) = $(dir $result\*.blg |% {
146+
147+
$csvrlat = get-pc $_ $center '\Cluster CSVFS(_Total)\avg. sec/read'
148+
$csvwlat = get-pc $_ $center '\Cluster CSVFS(_Total)\avg. sec/write'
149+
$csvr = get-pc $_ $center '\Cluster CSVFS(_Total)\reads/sec'
150+
$csvw = get-pc $_ $center '\Cluster CSVFS(_Total)\writes/sec'
151+
152+
$csvrtotal += $csvr
153+
154+
$csvwtotal += $csvw
155+
156+
[pscustomobject] @{ 'avrtime' = $csvrlat*$csvr; 'avwtime' = $csvwlat*$csvw }
157+
158+
} | measure -Sum -Property avrtime,avwtime).Sum
159+
160+
$avrlat /= $csvrtotal
161+
$avwlat /= $csvwtotal
162+
128163
# capture results
129-
$w,$qos,$avcpu,$iops -join "`t" >> $outfile
164+
$w,$qos,$avcpu,$iops,$avrlat,$avwlat -join "`t" >> $outfile
130165

131166
# archive results
132167
compress-archive -Path $(dir $result\* -Exclude *.zip) -DestinationPath $result\$curaddspec.zip
@@ -135,7 +170,7 @@ foreach ($w in 0,10,30) {
135170

136171
# stop within targetwindow% of cpu (+/- % of target)
137172
if (is-within $avcpu $cputarget $cputargetwindow) {
138-
write-host -ForegroundColor Green Stopping in target window at $avcpu with QoS at $qos
173+
write-host -ForegroundColor Green "Stopping in target window at $('{0:N2}' -f $avcpu) with QoS $qos"
139174
break
140175
}
141176

@@ -154,17 +189,17 @@ foreach ($w in 0,10,30) {
154189
}
155190

156191
if ($inwindow) {
157-
write-host -ForegroundColor Yellow Stopping in window of prior measurement at $avcpu with QoS at $qos
192+
write-host -ForegroundColor Yellow "Stopping in window of prior measurement at $('{0:N2}' -f $avcpu) with QoS $qos"
158193
break
159194
}
160195

161196
# stop if next qos target is less than initial
162197
if ($nextqos -lt $qosinitial) {
163-
write-host -ForegroundColor Red Stopping with underflow targeting $nextqos less than initial $qosinitial
198+
write-host -ForegroundColor Red "Stopping with underflow targeting $nextqos less than initial $qosinitial"
164199
break
165200
}
166201

167-
write-host -ForegroundColor Cyan Next loop targeting $nextqos
202+
write-host -ForegroundColor Cyan "Loop acheived $('{0:N2}' -f $avcpu) @ QoS $qos v. target $cputarget - next loop targeting QoS $nextqos"
168203

169204
# record this datapoint as measured, move along to the next
170205
$h[$qos] = 1

Frameworks/VMFleet/watch-cpu.ps1

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ if ($clip -lt 10) {
122122
$clip = 10
123123
}
124124

125+
# set window and buffer size simultaneously so we don't have extra scrollbars
126+
cls
125127
[console]::SetWindowSize($width,$clip + $legend.Count + 1)
128+
[console]::BufferWidth = [console]::WindowWidth
129+
[console]::BufferHeight = [console]::WindowHeight
126130

127131
# scale divisions at x%
128132
# this should evenly divide 100%
@@ -137,10 +141,12 @@ while ($true) {
137141
}
138142

139143
# get all specific instances and count them into appropriate measurement bucket
140-
(get-counter -ComputerName $ComputerName -SampleInterval $SampleInterval '\Hyper-V Hypervisor Logical Processor(*)\% Total Run Time').Countersamples |% {
144+
(get-counter -ComputerName $ComputerName -SampleInterval $SampleInterval '\Hyper-V Hypervisor Logical Processor(*)\% Total Run Time','\Processor Information(_Total)\% Processor Performance').Countersamples |% {
141145

142-
if ($_.InstanceName -ne '_Total') {
143-
$m[[int]($_.CookedValue/$div)] += 1
146+
if ($_.Path -match 'Processor Information') {
147+
$pperf = $_.CookedValue/100
148+
} elseif ($_.InstanceName -ne '_Total') {
149+
$m[[math]::Floor($_.CookedValue/$div)] += 1
144150
} else {
145151
$total = $_.CookedValue
146152
}
@@ -174,8 +180,9 @@ while ($true) {
174180

175181
cls
176182
write-host -NoNewline ($lines + $legend -join "`n")
177-
write-host -NoNewLine ("`n" + (center-pad ("{1} Total: {0:0.0}%" -f $total,$ComputerName) $width))
183+
write-host -NoNewLine ("`n" + (center-pad ("{2} Total: {0:0.0}% Normalized: {1:0.0}%" -f $total,($total*$pperf),$ComputerName) $width))
178184

179185
# move the cursor to indicate average utilization
180-
[console]::SetCursorPosition([console]::WindowWidth*$total/100,[console]::CursorTop-$legend.Count)
186+
# column number is zero based, width is 1-based
187+
[console]::SetCursorPosition([math]::Floor(($width - 1)*$total/100),[console]::CursorTop-$legend.Count)
181188
}

0 commit comments

Comments
 (0)