From 92cb0ac1c2ecbedc59f2011cfdedd537d4709acb Mon Sep 17 00:00:00 2001 From: Flor Elisa Chacon Ochoa Date: Tue, 7 Jun 2022 15:24:36 -0700 Subject: [PATCH 1/3] FullName --- tools/CorrelationTestbed/Process-CorrelationResults.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 index 2860fb961c..27c90acfc6 100644 --- a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 +++ b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 @@ -18,7 +18,7 @@ if (Test-Path $failedFile) foreach ($result in (Get-ChildItem $ResultsPath -Directory)) { - $resultJSON = Join-Path $result "install_and_correlate.json" + $resultJSON = Join-Path $result.FullName "install_and_correlate.json" if (-not (Test-Path $resultJSON)) { continue From 5296952ec8a491904893ad4819ad1310c8e1ccdd Mon Sep 17 00:00:00 2001 From: Flor Elisa Chacon Ochoa Date: Tue, 7 Jun 2022 16:32:39 -0700 Subject: [PATCH 2/3] Compute stats --- .../Process-CorrelationResults.ps1 | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 index 27c90acfc6..46e3934f28 100644 --- a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 +++ b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 @@ -5,6 +5,7 @@ Param( $resultFile = Join-Path $ResultsPath "results.csv" $failedFile = Join-Path $ResultsPath "failed.csv" +$statsFile = Join-Path $ResultsPath "stats.json" if (Test-Path $resultFile) { @@ -16,22 +17,48 @@ if (Test-Path $failedFile) Remove-Item $failedFile -Force } +$stats = @{ + Total = 0 + Missing = 0 + Completed = 0 + Failed = 0 + CorrelatePackageKnown = 0 + CorrelateArchive = 0 +} + +# Aggregate results in a single CSV file foreach ($result in (Get-ChildItem $ResultsPath -Directory)) { + $stats.Total++ + $resultJSON = Join-Path $result.FullName "install_and_correlate.json" - if (-not (Test-Path $resultJSON)) + if (Test-Path $resultJSON) { - continue + $resultObj = (Get-Content -Path $resultJSON -Encoding utf8 | ConvertFrom-Json) } - $resultObj = (Get-Content -Path $resultJSON -Encoding utf8 | ConvertFrom-Json) + if (-not $resultObj) + { + # Result JSON file does not exist or is empty + $stats.Missing++ + continue + } if ($resultObj.HRESULT -eq 0) { + $stats.Completed++ + $stats.CorrelateArchive += $resultObj.CorrelateArchive + $stats.CorrelatePackageKnown += $resultObj.CorrelatePackageKnown Export-Csv -InputObject ($resultObj | Select-Object -Property * -ExcludeProperty @("Error", "Phase", "Action", "HRESULT") ) -Path $resultFile -Append } else { + $stats.Failed++ Export-Csv -InputObject $resultObj -Path $failedFile -Append } } + +# Write some stats to a file for quick evaluation +$stats.CorrelateArchiveRatio = $stats.CorrelateArchive / $stats.Completed +$stats.CorrelatePackageKnownRatio = $stats.CorrelatePackageKnown / $stats.Completed +$stats | ConvertTo-Json | Out-File $statsFile -Force From a5a9be793e13c9fc6288b851bb74adde139f8a1f Mon Sep 17 00:00:00 2001 From: Flor Elisa Chacon Ochoa Date: Tue, 7 Jun 2022 16:40:08 -0700 Subject: [PATCH 3/3] Add stat --- tools/CorrelationTestbed/Process-CorrelationResults.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 index 46e3934f28..7e1f4d1529 100644 --- a/tools/CorrelationTestbed/Process-CorrelationResults.ps1 +++ b/tools/CorrelationTestbed/Process-CorrelationResults.ps1 @@ -59,6 +59,7 @@ foreach ($result in (Get-ChildItem $ResultsPath -Directory)) } # Write some stats to a file for quick evaluation +$stats.CompletedRatio = $stats.Completed / $stats.Total $stats.CorrelateArchiveRatio = $stats.CorrelateArchive / $stats.Completed $stats.CorrelatePackageKnownRatio = $stats.CorrelatePackageKnown / $stats.Completed $stats | ConvertTo-Json | Out-File $statsFile -Force