gh-131253: free-threaded build support for pystats (gh-137189)
Allow the --enable-pystats build option to be used with free-threading. The stats are now stored on a per-interpreter basis, rather than process global. For free-threaded builds, the stats structure is allocated per-thread and then periodically merged into the per-interpreter stats structure (on thread exit or when the reporting function is called). Most of the pystats related code has be moved into the file Python/pystats.c.
This commit is contained in:
@@ -62,8 +62,9 @@
|
||||
#ifdef Py_STATS
|
||||
#define INSTRUCTION_STATS(op) \
|
||||
do { \
|
||||
PyStats *s = _PyStats_GET(); \
|
||||
OPCODE_EXE_INC(op); \
|
||||
if (_Py_stats) _Py_stats->opcode_stats[lastopcode].pair_count[op]++; \
|
||||
if (s) s->opcode_stats[lastopcode].pair_count[op]++; \
|
||||
lastopcode = op; \
|
||||
} while (0)
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user