@echo off
setlocal EnableExtensions
cd /d "%~dp0"

if not "%~1"=="" (
    echo Usage: benchmark.bat
    echo.
    echo The retired smoke/quick/full matrix is no longer run by this script.
    exit /b 2
)

call build.bat baseline test
if errorlevel 1 exit /b 1

for /f "delims=" %%I in ('powershell.exe -NoProfile -Command "Get-Date -Format yyyyMMdd-HHmmss"') do set "UC_RUN_ID=%%I-focused"
set "UC_RESULT_DIR=results\benchmarks\%UC_RUN_ID%"
mkdir "%UC_RESULT_DIR%" 2>nul

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "tools\write_benchmark_environment.ps1" -ResultDirectory "%UC_RESULT_DIR%" -RunId "%UC_RUN_ID%" -Scale "focused-100k-7x" -Profiles "baseline"
if errorlevel 1 exit /b 1

echo.
echo === Focused resize benchmark: baseline /O2, 100000 operations, 7 repeats ===
"out\bin\baseline\Release\uc_focused_bench.exe" --min-n 256 --max-n 65536 --operations 100000 --repeats 7 --output "%UC_RESULT_DIR%\baseline-focused.csv" > "%UC_RESULT_DIR%\summary.md"
if errorlevel 1 exit /b 1
type "%UC_RESULT_DIR%\summary.md"

echo.
echo Benchmark run completed: %UC_RESULT_DIR%
exit /b 0
