8000 gh-127951: Add build option to enable pystats on Windows (GH-127952) · python/cpython@b9b3e4a · GitHub
[go: up one dir, main page]

Skip to content

Commit b9b3e4a

Browse files
authored
gh-127951: Add build option to enable pystats on Windows (GH-127952)
1 parent b5d1e45 commit b9b3e4a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add option ``--pystats`` to the Windows build to enable performance statistics collection.

PCbuild/build.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ echo. --regen Regenerate all opcodes, grammar and tokens.
3939
echo. --experimental-jit Enable the experimental just-in-time compiler.
4040
echo. --experimental-jit-off Ditto but off by default (PYTHON_JIT=1 enables).
4141
echo. --experimental-jit-interpreter Enable the experimental Tier 2 interpreter.
42+
echo. --pystats Enable PyStats collection.
4243
echo.
4344
echo.Available flags to avoid building certain modules.
4445
echo.These flags have no effect if '-e' is not given:
@@ -93,6 +94,7 @@ if "%~1"=="--experimental-jit" (set UseJIT=true) & (set UseTIER2=1) & shift & go
9394
if "%~1"=="--experimental-jit-off" (set UseJIT=true) & (set UseTIER2=3) & shift & goto CheckOpts
9495
if "%~1"=="--experimental-jit-interpreter" (set UseTIER2=4) & shift & goto CheckOpts
9596
if "%~1"=="--experimental-jit-interpreter-off" (set UseTIER2=6) & shift & goto CheckOpts
97+
if "%~1"=="--pystats" (set PyStats=1) & shift & goto CheckOpts
9698
rem These use the actual property names used by MSBuild. We could just let
9799
rem them in through the environment, but we specify them on the command line
98100
rem anyway for visibility so set defaults after this
@@ -186,6 +188,7 @@ echo on
186188
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
187189
/p:UseJIT=%UseJIT%^
188190
/p:UseTIER2=%UseTIER2%^
191+
/p:PyStats=%PyStats%^
189192
%1 %2 %3 %4 %5 %6 %7 %8 %9
190193

191194
@echo off

PCbuild/pyproject.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
<PropertyGroup>
4343
<_DebugPreprocessorDefinition>NDEBUG;</_DebugPreprocessorDefinition>
4444
<_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG;</_DebugPreprocessorDefinition>
45+
<_PyStatsPreprocessorDefinition>PyStats;</_PyStatsPreprocessorDefinition>
46+
<_PyStatsPreprocessorDefinition Condition="$(PySTATS) != ''">Py_STATS;</_PyStatsPreprocessorDefinition>
4547
<_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
4648
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;</_PlatformPreprocessorDefinition>
4749
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
@@ -50,7 +52,7 @@
5052
<ItemDefinitionGroup>
5153
<ClCompile>
5254
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
53-
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
55+
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
5456
<PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5557

5658
<Optimization>MaxSpeed</Optimization>

0 commit comments

Comments
 (0)
0