https://github.com/python/cpython/commit/b9b3e4a076caddf7876d1d4d762a117a26faffcf
commit: b9b3e4a076caddf7876d1d4d762a117a26faffcf
branch: main
author: Pieter Eendebak <[email protected]>
committer: zooba <[email protected]>
date: 2024-12-19T14:45:34Z
summary:

gh-127951: Add build option to enable pystats on Windows (GH-127952)

files:
A Misc/NEWS.d/next/Build/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst
M PCbuild/build.bat
M PCbuild/pyproject.props

diff --git 
a/Misc/NEWS.d/next/Build/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst 
b/Misc/NEWS.d/next/Build/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst
new file mode 100644
index 00000000000000..0c1df0e6bd7baa
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst
@@ -0,0 +1 @@
+Add option ``--pystats`` to the Windows build to enable performance statistics 
collection.
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index 6d3ce81651ade5..d3e3894c203a65 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -39,6 +39,7 @@ echo.  --regen        Regenerate all opcodes, grammar and 
tokens.
 echo.  --experimental-jit          Enable the experimental just-in-time 
compiler.
 echo.  --experimental-jit-off      Ditto but off by default (PYTHON_JIT=1 
enables).
 echo.  --experimental-jit-interpreter  Enable the experimental Tier 2 
interpreter.
+echo.  --pystats      Enable PyStats collection.
 echo.
 echo.Available flags to avoid building certain modules.
 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
 if "%~1"=="--experimental-jit-off" (set UseJIT=true) & (set UseTIER2=3) & 
shift & goto CheckOpts
 if "%~1"=="--experimental-jit-interpreter" (set UseTIER2=4) & shift & goto 
CheckOpts
 if "%~1"=="--experimental-jit-interpreter-off" (set UseTIER2=6) & shift & goto 
CheckOpts
+if "%~1"=="--pystats" (set PyStats=1) & shift & goto CheckOpts
 rem These use the actual property names used by MSBuild.  We could just let
 rem them in through the environment, but we specify them on the command line
 rem anyway for visibility so set defaults after this
@@ -186,6 +188,7 @@ echo on
  /p:UseTestMarker=%UseTestMarker% %GITProperty%^
  /p:UseJIT=%UseJIT%^
  /p:UseTIER2=%UseTIER2%^
+ /p:PyStats=%PyStats%^
  %1 %2 %3 %4 %5 %6 %7 %8 %9
 
 @echo off
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index c65341179376ea..17abfa85201a90 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -42,6 +42,8 @@
   <PropertyGroup>
     <_DebugPreprocessorDefinition>NDEBUG;</_DebugPreprocessorDefinition>
     <_DebugPreprocessorDefinition Condition="$(Configuration) == 
'Debug'">_DEBUG;</_DebugPreprocessorDefinition>
+    <_PyStatsPreprocessorDefinition>PyStats;</_PyStatsPreprocessorDefinition>
+    <_PyStatsPreprocessorDefinition Condition="$(PySTATS) != 
''">Py_STATS;</_PyStatsPreprocessorDefinition>
     <_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
     <_PlatformPreprocessorDefinition Condition="$(Platform) == 
'x64'">_WIN64;</_PlatformPreprocessorDefinition>
     <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and 
$(PlatformToolset) != 
'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
@@ -50,7 +52,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(SupportPGO)' and 
($(Configuration) == 'PGInstrument' or $(Configuration) == 
'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 
       <Optimization>MaxSpeed</Optimization>

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to