blob: 5988c0a268db800f01af7c5a0c4e3535c3c96e89 [file] [log] [blame]
Christian Heimesbfd49852007-11-20 09:34:16 +00001@echo off
2rem A batch program to build PGO (Profile guided optimization) by first
3rem building instrumented binaries, then running the testsuite, and
4rem finally building the optimized code.
5rem Note, after the first instrumented run, one can just keep on
6rem building the PGUpdate configuration while developing.
7
8setlocal
9set platf=Win32
Steve Dower65e4cb12014-11-22 12:54:57 -080010set parallel=/m
Zachary Warecb09dca2014-07-31 23:48:45 -050011set dir=%~dp0
Christian Heimesbfd49852007-11-20 09:34:16 +000012
13rem use the performance testsuite. This is quick and simple
Zachary Warecb09dca2014-07-31 23:48:45 -050014set job1="%dir%..\tools\pybench\pybench.py" -n 1 -C 1 --with-gc
15set path1="%dir%..\tools\pybench"
Christian Heimesbfd49852007-11-20 09:34:16 +000016
17rem or the whole testsuite for more thorough testing
Zachary Warecb09dca2014-07-31 23:48:45 -050018set job2="%dir%..\lib\test\regrtest.py"
19set path2="%dir%..\lib"
Christian Heimesbfd49852007-11-20 09:34:16 +000020
21set job=%job1%
22set clrpath=%path1%
23
24:CheckOpts
25if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
26if "%1"=="-2" (set job=%job2%) & (set clrpath=%path2%) & shift & goto CheckOpts
Steve Dower65e4cb12014-11-22 12:54:57 -080027if "%1"=="-M" (set parallel=) & shift & goto CheckOpts
Christian Heimesbfd49852007-11-20 09:34:16 +000028
Christian Heimesbfd49852007-11-20 09:34:16 +000029
Zachary Warecb09dca2014-07-31 23:48:45 -050030rem We cannot cross compile PGO builds, as the optimization needs to be run natively
31set vs_platf=x86
Steve Dower65e4cb12014-11-22 12:54:57 -080032set PGO=%dir%win32-pgo
33
34if "%platf%"=="x64" (set vs_platf=amd64) & (set PGO=%dir%amd64-pgo)
Zachary Warecb09dca2014-07-31 23:48:45 -050035rem Setup the environment
Steve Dower65e4cb12014-11-22 12:54:57 -080036call "%dir%env.bat" %vs_platf%
37
Zachary Warecb09dca2014-07-31 23:48:45 -050038
Christian Heimesbfd49852007-11-20 09:34:16 +000039rem build the instrumented version
Steve Dower65e4cb12014-11-22 12:54:57 -080040msbuild "%dir%pcbuild.proj" %parallel% /t:Build /p:Configuration=PGInstrument /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
Christian Heimesbfd49852007-11-20 09:34:16 +000041
42rem remove .pyc files, .pgc files and execute the job
Steve Dower65e4cb12014-11-22 12:54:57 -080043"%PGO%\python.exe" "%dir%rmpyc.py" %clrpath%
44del "%PGO%\*.pgc"
45"%PGO%\python.exe" %job%
Christian Heimesbfd49852007-11-20 09:34:16 +000046
Zachary Warecb09dca2014-07-31 23:48:45 -050047rem build optimized version
Steve Dower65e4cb12014-11-22 12:54:57 -080048msbuild "%dir%pcbuild.proj" %parallel% /t:Build /p:Configuration=PGUpdate /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9