blob: f5135836027ca88d3535926b59fdc75a08dde8db [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
Zachary Warecb09dca2014-07-31 23:48:45 -050010set dir=%~dp0
Christian Heimesbfd49852007-11-20 09:34:16 +000011
12rem use the performance testsuite. This is quick and simple
Zachary Warecb09dca2014-07-31 23:48:45 -050013set job1="%dir%..\tools\pybench\pybench.py" -n 1 -C 1 --with-gc
14set path1="%dir%..\tools\pybench"
Christian Heimesbfd49852007-11-20 09:34:16 +000015
16rem or the whole testsuite for more thorough testing
Zachary Warecb09dca2014-07-31 23:48:45 -050017set job2="%dir%..\lib\test\regrtest.py"
18set path2="%dir%..\lib"
Christian Heimesbfd49852007-11-20 09:34:16 +000019
20set job=%job1%
21set clrpath=%path1%
22
23:CheckOpts
24if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
25if "%1"=="-2" (set job=%job2%) & (set clrpath=%path2%) & shift & goto CheckOpts
26
Zachary Warecb09dca2014-07-31 23:48:45 -050027set PGI=%dir%%platf%-pgi
28set PGO=%dir%%platf%-pgo
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
32if "%platf%"=="x64" (set vs_platf=amd64)
33rem Setup the environment
34call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" %vs_platf%
35
Christian Heimesbfd49852007-11-20 09:34:16 +000036rem build the instrumented version
Zachary Warecb09dca2014-07-31 23:48:45 -050037msbuild "%dir%pcbuild.sln" /t:Build /p:Configuration=PGInstrument /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
Christian Heimesbfd49852007-11-20 09:34:16 +000038
39rem remove .pyc files, .pgc files and execute the job
Zachary Warecb09dca2014-07-31 23:48:45 -050040"%PGI%\python.exe" "%dir%rmpyc.py" %clrpath%
41del "%PGI%\*.pgc"
42"%PGI%\python.exe" %job%
Christian Heimesbfd49852007-11-20 09:34:16 +000043
Zachary Warecb09dca2014-07-31 23:48:45 -050044rem clean
45if exist "%PGO%" del /s /q "%PGO%"
Christian Heimesbfd49852007-11-20 09:34:16 +000046
Zachary Warecb09dca2014-07-31 23:48:45 -050047rem build optimized version
48msbuild "%dir%pcbuild.sln" /t:Build /p:Configuration=PGUpdate /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9