diff options
author | Michael Droettboom <mdboom@gmail.com> | 2024-02-26 17:51:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 17:51:47 (GMT) |
commit | b05afdd5ec325bdb4cc89bb3be177ed577bea41f (patch) | |
tree | ecdb6276a76f5af92e3c3a9d249a5eb8361c9499 /Python/optimizer.c | |
parent | 96c10c648565c7406d5606099dbbb937310c26dc (diff) | |
download | cpython-b05afdd5ec325bdb4cc89bb3be177ed577bea41f.zip cpython-b05afdd5ec325bdb4cc89bb3be177ed577bea41f.tar.gz cpython-b05afdd5ec325bdb4cc89bb3be177ed577bea41f.tar.bz2 |
gh-115168: Add pystats counter for invalidated executors (GH-115169)
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r-- | Python/optimizer.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c index 6b2ba3a..c04ee17 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -1348,7 +1348,7 @@ _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj) * May cause other executors to be invalidated as well */ void -_Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj) +_Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation) { _PyBloomFilter obj_filter; _Py_BloomFilter_Init(&obj_filter); @@ -1360,6 +1360,9 @@ _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj) _PyExecutorObject *next = exec->vm_data.links.next; if (bloom_filter_may_contain(&exec->vm_data.bloom, &obj_filter)) { _Py_ExecutorClear(exec); + if (is_invalidation) { + OPT_STAT_INC(executors_invalidated); + } } exec = next; } @@ -1367,7 +1370,7 @@ _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj) /* Invalidate all executors */ void -_Py_Executors_InvalidateAll(PyInterpreterState *interp) +_Py_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation) { while (interp->executor_list_head) { _PyExecutorObject *executor = interp->executor_list_head; @@ -1378,5 +1381,8 @@ _Py_Executors_InvalidateAll(PyInterpreterState *interp) else { _Py_ExecutorClear(executor); } + if (is_invalidation) { + OPT_STAT_INC(executors_invalidated); + } } } |