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