124 lines
3.9 KiB
PowerShell
124 lines
3.9 KiB
PowerShell
|
|
# Image Processing Benchmark Runner
|
||
|
|
# This script provides easy access to common benchmark scenarios
|
||
|
|
|
||
|
|
param(
|
||
|
|
[Parameter(Position=0)]
|
||
|
|
[ValidateSet("all", "quick", "parallel", "chunks", "sizes", "stress", "help")]
|
||
|
|
[string]$Scenario = "help",
|
||
|
|
|
||
|
|
[switch]$Fast,
|
||
|
|
[switch]$DetailedOutput
|
||
|
|
)
|
||
|
|
|
||
|
|
$projectPath = "MaddoShared.Benchmarks"
|
||
|
|
|
||
|
|
function Show-Help {
|
||
|
|
Write-Host @"
|
||
|
|
Image Processing Benchmark Runner
|
||
|
|
==================================
|
||
|
|
|
||
|
|
Usage: .\run-benchmarks.ps1 [scenario] [-Fast] [-DetailedOutput]
|
||
|
|
|
||
|
|
Scenarios:
|
||
|
|
all - Run all benchmarks (60-120 minutes)
|
||
|
|
quick - Fast test run for development (5-10 minutes)
|
||
|
|
parallel - Test parallel processing strategies (20-30 minutes)
|
||
|
|
chunks - Optimize chunk size (20-30 minutes)
|
||
|
|
sizes - Test different image sizes (45-90 minutes)
|
||
|
|
stress - Large-scale stress test (2-4 hours)
|
||
|
|
help - Show this help message
|
||
|
|
|
||
|
|
Flags:
|
||
|
|
-Fast - Use dry run for faster but less accurate results
|
||
|
|
-DetailedOutput - Show detailed output
|
||
|
|
|
||
|
|
Examples:
|
||
|
|
.\run-benchmarks.ps1 quick
|
||
|
|
.\run-benchmarks.ps1 parallel -Fast
|
||
|
|
.\run-benchmarks.ps1 stress -DetailedOutput
|
||
|
|
|
||
|
|
Results will be saved to: MaddoShared.Benchmarks\BenchmarkDotNet.Artifacts\results\
|
||
|
|
"@
|
||
|
|
}
|
||
|
|
|
||
|
|
function Run-Benchmark {
|
||
|
|
param(
|
||
|
|
[string]$Filter,
|
||
|
|
[string]$Description
|
||
|
|
)
|
||
|
|
|
||
|
|
Write-Host "`n========================================" -ForegroundColor Cyan
|
||
|
|
Write-Host " $Description" -ForegroundColor Cyan
|
||
|
|
Write-Host "========================================`n" -ForegroundColor Cyan
|
||
|
|
|
||
|
|
$args = @("-c", "Release")
|
||
|
|
|
||
|
|
if ($Filter) {
|
||
|
|
$args += @("--", "--filter", $Filter)
|
||
|
|
}
|
||
|
|
|
||
|
|
# Note: We don't pass --job arguments anymore because they override
|
||
|
|
# the InProcess toolchain configuration needed for Windows compatibility
|
||
|
|
if ($Fast) {
|
||
|
|
Write-Host "Note: Fast mode (-Fast) requested but not using --job dry" -ForegroundColor Yellow
|
||
|
|
Write-Host "Reason: --job arguments override InProcess toolchain config" -ForegroundColor Yellow
|
||
|
|
Write-Host "The benchmark will run with the default InProcessConfig settings.`n" -ForegroundColor Yellow
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($DetailedOutput) {
|
||
|
|
$args += "--verbosity", "detailed"
|
||
|
|
}
|
||
|
|
|
||
|
|
Push-Location $projectPath
|
||
|
|
try {
|
||
|
|
dotnet run @args
|
||
|
|
}
|
||
|
|
finally {
|
||
|
|
Pop-Location
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Main execution
|
||
|
|
switch ($Scenario) {
|
||
|
|
"help" {
|
||
|
|
Show-Help
|
||
|
|
}
|
||
|
|
|
||
|
|
"all" {
|
||
|
|
Write-Host "Running ALL benchmarks..." -ForegroundColor Yellow
|
||
|
|
Write-Host "This will take 60-120 minutes. Press Ctrl+C to cancel.`n" -ForegroundColor Yellow
|
||
|
|
Start-Sleep -Seconds 3
|
||
|
|
Run-Benchmark "" "All Benchmarks"
|
||
|
|
}
|
||
|
|
|
||
|
|
"quick" {
|
||
|
|
Write-Host "Running QUICK test..." -ForegroundColor Green
|
||
|
|
Run-Benchmark "*ImageProcessingBenchmarks*" "Quick Development Test"
|
||
|
|
}
|
||
|
|
|
||
|
|
"parallel" {
|
||
|
|
Write-Host "Running PARALLEL processing benchmarks..." -ForegroundColor Green
|
||
|
|
Run-Benchmark "*ImageProcessingBenchmarks*" "Parallel Processing Strategies"
|
||
|
|
}
|
||
|
|
|
||
|
|
"chunks" {
|
||
|
|
Write-Host "Running CHUNK SIZE optimization..." -ForegroundColor Green
|
||
|
|
Run-Benchmark "*ChunkSizeBenchmarks*" "Chunk Size Optimization"
|
||
|
|
}
|
||
|
|
|
||
|
|
"sizes" {
|
||
|
|
Write-Host "Running IMAGE SIZE comparison..." -ForegroundColor Green
|
||
|
|
Run-Benchmark "*ImageSizeBenchmarks*" "Image Size Impact Analysis"
|
||
|
|
}
|
||
|
|
|
||
|
|
"stress" {
|
||
|
|
Write-Host "Running STRESS TEST..." -ForegroundColor Red
|
||
|
|
Write-Host "WARNING: This will take 2-4 hours and use significant disk space!" -ForegroundColor Red
|
||
|
|
Write-Host "Press Ctrl+C within 5 seconds to cancel...`n" -ForegroundColor Red
|
||
|
|
Start-Sleep -Seconds 5
|
||
|
|
Run-Benchmark "*StressTestBenchmark*" "Large-Scale Stress Test"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "`nBenchmark execution complete!" -ForegroundColor Green
|
||
|
|
Write-Host "Results saved to: $projectPath\BenchmarkDotNet.Artifacts\results\" -ForegroundColor Green
|