Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [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 | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 10 | set dir=%~dp0 |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 11 | |
| 12 | rem use the performance testsuite. This is quick and simple |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 13 | set job1="%dir%..\tools\pybench\pybench.py" -n 1 -C 1 --with-gc |
| 14 | set path1="%dir%..\tools\pybench" |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 15 | |
| 16 | rem or the whole testsuite for more thorough testing |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 17 | set job2="%dir%..\lib\test\regrtest.py" |
| 18 | set path2="%dir%..\lib" |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 19 | |
| 20 | set job=%job1% |
| 21 | set clrpath=%path1% |
| 22 | |
| 23 | :CheckOpts |
| 24 | if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts |
| 25 | if "%1"=="-2" (set job=%job2%) & (set clrpath=%path2%) & shift & goto CheckOpts |
| 26 | |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 27 | set PGI=%dir%%platf%-pgi |
| 28 | set PGO=%dir%%platf%-pgo |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 29 | |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -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 | if "%platf%"=="x64" (set vs_platf=amd64) |
| 33 | rem Setup the environment |
| 34 | call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %vs_platf% |
| 35 | |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 36 | rem build the instrumented version |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 37 | msbuild "%dir%pcbuild.sln" /t:Build /p:Configuration=PGInstrument /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9 |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 38 | |
| 39 | rem remove .pyc files, .pgc files and execute the job |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 40 | "%PGI%\python.exe" "%dir%rmpyc.py" %clrpath% |
| 41 | del "%PGI%\*.pgc" |
| 42 | "%PGI%\python.exe" %job% |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 43 | |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 44 | rem clean |
| 45 | if exist "%PGO%" del /s /q "%PGO%" |
Christian Heimes | bfd4985 | 2007-11-20 09:34:16 +0000 | [diff] [blame] | 46 | |
Zachary Ware | cb09dca | 2014-07-31 23:48:45 -0500 | [diff] [blame^] | 47 | rem build optimized version |
| 48 | msbuild "%dir%pcbuild.sln" /t:Build /p:Configuration=PGUpdate /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9 |