From 587a65c53ec549294a8740a107bbf3de2ac65089 Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Fri, 13 Dec 2024 10:31:40 +0100 Subject: [PATCH 1/8] Enable PyStats collection on windows --- PCbuild/build.bat | 3 +++ PCbuild/pyproject.props | 1 + 2 files changed, 4 insertions(+) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 6d3ce81651ade5..7abe05d2f9642d 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:Py_Stats=%Py_Stats%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index c65341179376ea..b8c445a4ab08f2 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -42,6 +42,7 @@ <_DebugPreprocessorDefinition>NDEBUG; <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; + <_DebugPreprocessorDefinition Condition="$(Py_STATS) == ''">Py_STATS; <_PlatformPreprocessorDefinition>_WIN32; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition) From e2030ca2254753a119e845b513bae0c47b8ab271 Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Sat, 14 Dec 2024 20:54:20 +0100 Subject: [PATCH 2/8] use separate preprocessor definition --- PCbuild/build.bat | 2 +- PCbuild/pyproject.props | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 7abe05d2f9642d..c1d1980beef2ef 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -39,7 +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. --pystats Enable PyStats collection. echo. echo.Available flags to avoid building certain modules. echo.These flags have no effect if '-e' is not given: diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index b8c445a4ab08f2..a62ea96d3c400f 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -42,7 +42,8 @@ <_DebugPreprocessorDefinition>NDEBUG; <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; - <_DebugPreprocessorDefinition Condition="$(Py_STATS) == ''">Py_STATS; + <_PyStatsPreprocessorDefinition>PyStats; + <_PyStatsPreprocessorDefinition Condition="$(Py_STATS) == ''">Py_STATS; <_PlatformPreprocessorDefinition>_WIN32; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition) @@ -51,7 +52,7 @@ $(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories) - WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions) + WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions) _Py_USING_PGO=1;%(PreprocessorDefinitions) MaxSpeed From aadd880fa5071041dabf69c0ef751ce773509e34 Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Mon, 16 Dec 2024 17:13:34 +0100 Subject: [PATCH 3/8] Update PCbuild/pyproject.props Co-authored-by: Steve Dower --- PCbuild/pyproject.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index a62ea96d3c400f..e36e1ee9e092ed 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -43,7 +43,7 @@ <_DebugPreprocessorDefinition>NDEBUG; <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; <_PyStatsPreprocessorDefinition>PyStats; - <_PyStatsPreprocessorDefinition Condition="$(Py_STATS) == ''">Py_STATS; + <_PyStatsPreprocessorDefinition Condition="$(Py_STATS) != ''">Py_STATS; <_PlatformPreprocessorDefinition>_WIN32; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition) From e36c135415c84fab752d87bae7390aeb9204605a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:16:41 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst diff --git a/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst b/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst new file mode 100644 index 00000000000000..8a03c2ac42ae10 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/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. From d98645d178f22183affe9b829aa0f2594c9bba7e Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Thu, 19 Dec 2024 12:51:46 +0100 Subject: [PATCH 5/8] Update Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst Co-authored-by: Steve Dower --- .../next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst b/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst index 8a03c2ac42ae10..0c1df0e6bd7baa 100644 --- a/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst +++ b/Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst @@ -1 +1 @@ -Add option `--pystats` to the Windows build to enable performance statistics collection. +Add option ``--pystats`` to the Windows build to enable performance statistics collection. From 1c34ef1d2f8dd697d80715824534b4e96d3777d5 Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Thu, 19 Dec 2024 12:52:59 +0100 Subject: [PATCH 6/8] Update PCbuild/pyproject.props --- PCbuild/pyproject.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index e36e1ee9e092ed..17abfa85201a90 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -43,7 +43,7 @@ <_DebugPreprocessorDefinition>NDEBUG; <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; <_PyStatsPreprocessorDefinition>PyStats; - <_PyStatsPreprocessorDefinition Condition="$(Py_STATS) != ''">Py_STATS; + <_PyStatsPreprocessorDefinition Condition="$(PySTATS) != ''">Py_STATS; <_PlatformPreprocessorDefinition>_WIN32; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64; <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition) From b1e151ec52a24c9ba643d2e1e241f0ff58f658b1 Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Thu, 19 Dec 2024 12:53:47 +0100 Subject: [PATCH 7/8] review comment --- .../2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/NEWS.d/next/{Windows => Build}/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst (100%) diff --git a/Misc/NEWS.d/next/Windows/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 similarity index 100% rename from Misc/NEWS.d/next/Windows/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst rename to Misc/NEWS.d/next/Build/2024-12-16-16-16-35.gh-issue-127951.lpE13-.rst From cbf6ac0ec177a8c876901d700788c0ee99e474df Mon Sep 17 00:00:00 2001 From: Pieter Eendebak Date: Thu, 19 Dec 2024 12:57:53 +0100 Subject: [PATCH 8/8] use same style --- PCbuild/build.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index c1d1980beef2ef..d3e3894c203a65 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -188,7 +188,7 @@ echo on /p:UseTestMarker=%UseTestMarker% %GITProperty%^ /p:UseJIT=%UseJIT%^ /p:UseTIER2=%UseTIER2%^ - /p:Py_Stats=%Py_Stats%^ + /p:PyStats=%PyStats%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off