diff options
| author | JakobL-MSFT <[email protected]> | 2023-02-07 15:36:48 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-07 15:36:48 -0800 |
| commit | 208b227667182dfcd7bdf3ab4f5090aa823cf477 (patch) | |
| tree | 1b7d8ad37d67108ef7225b66eed00030f581584d /Build-SampleSet.ps1 | |
| parent | 9ab70a3207b3586eeef00298911b05e425d5a3a9 (diff) | |
Enable CodeQL to work thru reasonable workarounds. (#857)
Diffstat (limited to 'Build-SampleSet.ps1')
| -rw-r--r-- | Build-SampleSet.ps1 | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Build-SampleSet.ps1 b/Build-SampleSet.ps1 index 3295c8b4..3ef00efe 100644 --- a/Build-SampleSet.ps1 +++ b/Build-SampleSet.ps1 @@ -1,11 +1,16 @@ [CmdletBinding()] param( [hashtable]$SampleSet, - [string[]]$Configurations = @([string]::IsNullOrEmpty($env:Configuration) ? "Debug" : $env:Configuration), - [string[]]$Platforms = @([string]::IsNullOrEmpty($env:Platform) ? "x64" : $env:Platform), - $LogFilesDirectory = (Get-Location) + [string[]]$Configurations = @([string]::IsNullOrEmpty($env:WDS_Configuration) ? "Debug" : $env:WDS_Configuration), + [string[]]$Platforms = @([string]::IsNullOrEmpty($env:WDS_Platform) ? "x64" : $env:WDS_Platform), + $LogFilesDirectory = (Get-Location), + [int]$ThrottleLimit ) +$ThrottleFactor = 5 +$LogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors +$ThrottleLimit = $ThrottleLimit -eq 0 ? ($ThrottleFactor * $LogicalProcessors) : $ThrottleLimit + $Verbose = $false if ($PSBoundParameters.ContainsKey('Verbose')) { $Verbose = $PsBoundParameters.Get_Item('Verbose') @@ -18,10 +23,6 @@ $sampleBuilderFilePath = "$LogFilesDirectory\overview.htm" Remove-Item -Recurse -Path $LogFilesDirectory 2>&1 | Out-Null New-Item -ItemType Directory -Force -Path $LogFilesDirectory | Out-Null -$NumberOfLogicalProcessors = (Get-CIMInstance -Class 'CIM_Processor' -Verbose:$false).NumberOfLogicalProcessors -$Throttlefactor = 5 -$SolutionsInParallel = $Throttlefactor * $NumberOfLogicalProcessors - $oldPreference = $ErrorActionPreference $ErrorActionPreference = "stop" try { @@ -58,9 +59,11 @@ Write-Output ("Samples: "+$sampleSet.Count) Write-Output ("Configurations: "+$Configurations.Count+" ("+$Configurations+")") Write-Output ("Platforms: "+$Platforms.Count+" ("+$Platforms+")") Write-Output "Combinations: $SolutionsTotal" -Write-Output "Logical Processors: $NumberOfLogicalProcessors" -Write-Output "Throttle factor: $Throttlefactor" -Write-Output "Throttle limit: $SolutionsInParallel" +Write-Output "LogicalProcessors: $LogicalProcessors" +Write-Output "ThrottleFactor: $ThrottleFactor" +Write-Output "ThrottleLimit: $ThrottleLimit" +Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs" +Write-Output ("Disk Remaining (GB): "+(((Get-Volume ($DriveLetter=(Get-Item ".").PSDrive.Name)).SizeRemaining/1GB))) Write-Output "" Write-Output "T: Combinations" Write-Output "B: Built" @@ -78,7 +81,7 @@ $Results = @() $sw = [Diagnostics.Stopwatch]::StartNew() -$SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $SolutionsInParallel -Parallel { +$SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel { $LogFilesDirectory = $using:LogFilesDirectory $exclusionsSet = $using:exclusionsSet $Configurations = $using:Configurations @@ -133,11 +136,11 @@ $SampleSet.GetEnumerator() | ForEach-Object -ThrottleLimit $SolutionsInParallel ($using:jresult).SolutionsUnsupported += $thisunsupported ($using:jresult).SolutionsFailed += $thisfailed $SolutionsTotal = $using:SolutionsTotal - $SolutionsInParallel = $using:SolutionsInParallel + $ThrottleLimit = $using:ThrottleLimit $SolutionsBuilt = ($using:jresult).SolutionsBuilt $SolutionsRemaining = $SolutionsTotal - $SolutionsBuilt - $SolutionsRunning = $SolutionsRemaining -ge $SolutionsInParallel ? ($SolutionsInParallel) : ($SolutionsRemaining) - $SolutionsPending = $SolutionsRemaining -ge $SolutionsInParallel ? ($SolutionsRemaining - $SolutionsInParallel) : (0) + $SolutionsRunning = $SolutionsRemaining -ge $ThrottleLimit ? ($ThrottleLimit) : ($SolutionsRemaining) + $SolutionsPending = $SolutionsRemaining -ge $ThrottleLimit ? ($SolutionsRemaining - $ThrottleLimit) : (0) $SolutionsBuiltPercent = [Math]::Round(100 * ($SolutionsBuilt / $using:SolutionsTotal)) $TBRP = "T:" + ($SolutionsTotal) + "; B:" + (($using:jresult).SolutionsBuilt) + "; R:" + ($SolutionsRunning) + "; P:" + ($SolutionsPending) $rstr = "S:" + (($using:jresult).SolutionsSucceeded) + "; E:" + (($using:jresult).SolutionsExcluded) + "; U:" + (($using:jresult).SolutionsUnsupported) + "; F:" + (($using:jresult).SolutionsFailed) @@ -181,6 +184,7 @@ Write-Output "" Write-Output "Built all combinations." Write-Output "" Write-Output "Elapsed time: $min minutes, $seconds seconds." +Write-Output ("Disk Remaining (GB): "+(((Get-Volume ($DriveLetter=(Get-Item ".").PSDrive.Name)).SizeRemaining/1GB))) Write-Output ("Samples: "+$sampleSet.Count) Write-Output ("Configurations: "+$Configurations.Count+" ("+$Configurations+")") Write-Output ("Platforms: "+$Platforms.Count+" ("+$Platforms+")") |
