Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 1 | @echo off
|
| 2 | rem A batch program to build PGO (Profile guided optimization) by first
|
| 3 | rem building instrumented binaries, then running the testsuite, and
|
| 4 | rem finally building the optimized code.
|
| 5 | rem Note, after the first instrumented run, one can just keep on
|
| 6 | rem building the PGUpdate configuration while developing.
|
| 7 |
|
| 8 | setlocal
|
| 9 | set platf=Win32
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 10 | set parallel=/m
|
| 11 | set dir=%~dp0
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 12 |
|
| 13 | rem use the performance testsuite. This is quick and simple
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 14 | set job1="%dir%..\tools\pybench\pybench.py" -n 1 -C 1 --with-gc
|
| 15 | set path1="%dir%..\tools\pybench"
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 16 |
|
| 17 | rem or the whole testsuite for more thorough testing
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 18 | set job2="%dir%..\lib\test\regrtest.py"
|
| 19 | set path2="%dir%..\lib"
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 20 |
|
| 21 | set job=%job1%
|
| 22 | set clrpath=%path1%
|
| 23 |
|
| 24 | :CheckOpts
|
| 25 | if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
|
| 26 | if "%1"=="-2" (set job=%job2%) & (set clrpath=%path2%) & shift & goto CheckOpts
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 27 | if "%1"=="-M" (set parallel=) & shift & goto CheckOpts
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 28 |
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 29 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 30 | rem We cannot cross compile PGO builds, as the optimization needs to be run natively
|
| 31 | set vs_platf=x86
|
| 32 | set PGO=%dir%win32-pgo
|
| 33 |
|
| 34 | if "%platf%"=="x64" (set vs_platf=amd64) & (set PGO=%dir%amd64-pgo)
|
| 35 | rem Setup the environment
|
| 36 | call "%dir%env.bat" %vs_platf%
|
| 37 |
|
| 38 |
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 39 | rem build the instrumented version
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 40 | msbuild "%dir%pcbuild.proj" %parallel% /t:Build /p:Configuration=PGInstrument /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 41 |
|
| 42 | rem remove .pyc files, .pgc files and execute the job
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 43 | "%PGO%\python.exe" "%dir%rmpyc.py" %clrpath%
|
| 44 | del "%PGO%\*.pgc"
|
| 45 | "%PGO%\python.exe" %job%
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 46 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 47 | rem build optimized version
|
| 48 | msbuild "%dir%pcbuild.proj" %parallel% /t:Build /p:Configuration=PGUpdate /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
|