-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-perf-tests.bat
More file actions
102 lines (85 loc) · 2.88 KB
/
Copy pathrun-perf-tests.bat
File metadata and controls
102 lines (85 loc) · 2.88 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@echo off
REM ==========================================================================
REM run-perf-tests.bat -- build and run the LLVM versus TinyCC benchmarks.
REM
REM Usage:
REM run-perf-tests.bat full compile + hot-runtime matrix
REM run-perf-tests.bat runtime hot-runtime matrix only
REM run-perf-tests.bat quick one-sample smoke run
REM
REM STRATA_PRESET and STRATA_BENCH_EXE may override the default preset and
REM benchmark executable. CSV reports are written under build\default\perf.
REM ==========================================================================
setlocal
set "ROOT=%~dp0"
set "MODE=%~1"
if "%MODE%"=="" set "MODE=full"
if not "%~2"=="" goto usage
if /I not "%MODE%"=="full" if /I not "%MODE%"=="runtime" if /I not "%MODE%"=="quick" goto usage
if "%STRATA_PRESET%"=="" set "STRATA_PRESET=default"
if "%STRATA_BENCH_EXE%"=="" set "STRATA_BENCH_EXE=%ROOT%build\%STRATA_PRESET%\bin\strata_jit_bench.exe"
if "%STRATA_PERF_DIR%"=="" set "STRATA_PERF_DIR=%ROOT%build\%STRATA_PRESET%\perf"
where cmake >nul 2>&1
if errorlevel 1 (
echo error: cmake was not found on PATH
exit /b 1
)
pushd "%ROOT%" >nul
echo [1/3] Configure preset %STRATA_PRESET%
cmake --preset "%STRATA_PRESET%"
if errorlevel 1 goto configure_failed
echo.
echo [2/3] Build stratac and strata_jit_bench
REM Building stratac also stages LLVM-C.dll beside the benchmark on Windows.
cmake --build --preset "%STRATA_PRESET%" --target stratac strata_jit_bench
if errorlevel 1 goto build_failed
if not exist "%STRATA_BENCH_EXE%" (
echo error: benchmark executable not found: "%STRATA_BENCH_EXE%"
popd
exit /b 1
)
if not exist "%STRATA_PERF_DIR%" mkdir "%STRATA_PERF_DIR%"
if errorlevel 1 (
echo error: could not create output directory: "%STRATA_PERF_DIR%"
popd
exit /b 1
)
echo.
echo [3/3] Run %MODE% performance matrix
if /I "%MODE%"=="runtime" goto run_runtime
if /I "%MODE%"=="quick" goto run_quick
"%STRATA_BENCH_EXE%" --sizes 1,5,20 --iterations 7 --csv "%STRATA_PERF_DIR%\jit-performance.csv"
if errorlevel 1 goto benchmark_failed
set "REPORT=%STRATA_PERF_DIR%\jit-performance.csv"
goto success
:run_runtime
"%STRATA_BENCH_EXE%" --runtime-only --sizes 1,5,20 --iterations 11 --csv "%STRATA_PERF_DIR%\jit-runtime.csv"
if errorlevel 1 goto benchmark_failed
set "REPORT=%STRATA_PERF_DIR%\jit-runtime.csv"
goto success
:run_quick
"%STRATA_BENCH_EXE%" --quick --csv "%STRATA_PERF_DIR%\jit-performance-quick.csv"
if errorlevel 1 goto benchmark_failed
set "REPORT=%STRATA_PERF_DIR%\jit-performance-quick.csv"
goto success
:success
echo.
echo Performance tests completed successfully.
echo CSV report: "%REPORT%"
popd
exit /b 0
:configure_failed
echo error: CMake configure failed
popd
exit /b 1
:build_failed
echo error: benchmark build failed
popd
exit /b 1
:benchmark_failed
echo error: performance benchmark failed
popd
exit /b 1
:usage
echo Usage: run-perf-tests.bat [full^|runtime^|quick]
exit /b 2