-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.perf.data.ps1
49 lines (40 loc) · 1.5 KB
/
get.perf.data.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
param(
$arch = "amd64",
$flavor = "fre",
$branchName = "rs_es_corebuild",
$bId = ((dir \\winbuilds\release\$branchName | select -last 2 | select -first 1).Name),
$bName)
if ($null -ne $bName) {
$bParts = $bName.Split(".")
$branchName = $bParts | Select -Skip 2 -First 1
$bId = ($bParts[0]+"."+$bParts[1]+"."+$bParts[3])
}
if ($null -eq $bId) {
Write-Error "$bId is not set"
return
}
$buildCsv = "\\winbuilds\release\$branchName\$bId\$arch$flavor\build_logs\build$flavor.csv"
if (!(Test-Path $buildCsv)) {
Write-Error "Build data $buildCsv not found, build may be incomplete or does not exist"
return;
}
$dataMem = Get-Content $buildCsv | ConvertFrom-Csv
$col = $dataMem | gm | where { $_.Name.Contains('Memory\Available MBytes') } | select -first 1
$colName = $col.Name
$dataMem.$colName | Measure-Object -Minimum
$global:data = $dataMem.$colName
$result = $global:data | Measure-Object -Minimum
$absMin = $result.Minimum*1Mb/1Gb;
Write-Host "Absolute minimum $absMin Gb"
# Initialize an empty array to store the local minimums
$global:localMin = @()
# Iterate through the data set, excluding the first and last elements
for ($i=1; $i -lt ($data.Length-1); $i++) {
# If the current element is less than or equal to its neighbors, it's a local minimum
if ($data[$i] -le $data[$i-1] -and $data[$i] -le $data[$i+1]) {
$global:localMin += $data[$i]
}
}
$result = $global:localMin | Measure-Object -Average
$averageMin = $result.Average*1Mb/1Gb
Write-Host "Average local minimums $averageMin Gb"