Repository navigation
Commit 5f652ff
committed
pythongh-146527, pythongh-155811: Backport out-of-process GC statistics to 3.13
Add _remote_debugging.get_gc_stats and get_child_pids, and record
per-collection garbage collector statistics into per-generation ring
buffers discoverable through _Py_DebugOffsets. An external process can
read exact GC pause times, candidate counts and heap sizes from a
running interpreter without pausing it or loading anything into it.
Covers both the default and free-threaded GC.
gc.get_stats() gains two per-generation keys, candidates and duration,
alongside the existing ones. The addition is backwards compatible for
code that reads keys by name.
A seqcount (pythongh-155811) guards the out-of-process read against torn
snapshots: the writer bumps gc_stats.update_seq odd before an update and
even after (with a seq_cst fence and a release store), and the reader
brackets its whole-struct read with the counter, retrying once and then
failing cleanly rather than returning a half-updated record. This is the
canonical form of the ts_stop-last publish ordering the earlier revision
hand-rolled, so that trick and its zero-duration clamp are gone.
update_seq is appended to the heap-allocated gc_stats, so no interpreter
struct offset moves (abi-check IDENTICAL, default and free-threaded).
Backported from 3.15.1 parent 4061bc4 commit 5f652ff
11 files changed
Lines changed: 3104 additions & 53 deletions
File tree
- Include/internal
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
272 | 286 | | |
273 | 287 | | |
| 288 | + | |
| 289 | + | |
274 | 290 | | |
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
278 | 294 | | |
279 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
280 | 330 | | |
281 | 331 | | |
282 | 332 | | |
| |||
294 | 344 | | |
295 | 345 | | |
296 | 346 | | |
297 | | - | |
| 347 | + | |
298 | 348 | | |
299 | 349 | | |
300 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
280 | 289 | | |
281 | 290 | | |
282 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
809 | | - | |
810 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
811 | 813 | | |
812 | 814 | | |
813 | 815 | | |
| 816 | + | |
| 817 | + | |
814 | 818 | | |
815 | 819 | | |
816 | 820 | | |
| |||
821 | 825 | | |
822 | 826 | | |
823 | 827 | | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
824 | 835 | | |
825 | | - | |
826 | | - | |
| 836 | + | |
| 837 | + | |
827 | 838 | | |
828 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
829 | 847 | | |
830 | 848 | | |
831 | 849 | | |
| |||
0 commit comments