diff options
author | Michael Droettboom <mdboom@gmail.com> | 2023-10-31 00:02:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 00:02:45 (GMT) |
commit | 84b4533e8446cbff3325fffe939c87f7120a3ffd (patch) | |
tree | dd06a187031f6929c5bf4ba0e49ccac87e5b8ed8 /Python | |
parent | c6fe0869ab1d91525f88279f8567461082c0d3ce (diff) | |
download | cpython-84b4533e8446cbff3325fffe939c87f7120a3ffd.zip cpython-84b4533e8446cbff3325fffe939c87f7120a3ffd.tar.gz cpython-84b4533e8446cbff3325fffe939c87f7120a3ffd.tar.bz2 |
gh-109329: Count tier2 opcode misses (#110561)
This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/executor.c | 3 | ||||
-rw-r--r-- | Python/specialize.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Python/executor.c b/Python/executor.c index bfa7f7e..2884565 100644 --- a/Python/executor.c +++ b/Python/executor.c @@ -25,6 +25,7 @@ #undef DEOPT_IF #define DEOPT_IF(COND, INSTNAME) \ if ((COND)) { \ + UOP_STAT_INC(INSTNAME, miss); \ goto deoptimize; \ } @@ -93,7 +94,7 @@ _PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject (int)(stack_pointer - _PyFrame_Stackbase(frame))); pc++; OPT_STAT_INC(uops_executed); - UOP_EXE_INC(opcode); + UOP_STAT_INC(opcode, execution_count); #ifdef Py_STATS trace_uop_execution_counter++; #endif diff --git a/Python/specialize.c b/Python/specialize.c index d74c4c5..41e74c6 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -248,6 +248,9 @@ print_optimization_stats(FILE *out, OptimizationStats *stats) if (stats->opcode[i].execution_count) { fprintf(out, "uops[%s].execution_count : %" PRIu64 "\n", names[i], stats->opcode[i].execution_count); } + if (stats->opcode[i].miss) { + fprintf(out, "uops[%s].specialization.miss : %" PRIu64 "\n", names[i], stats->opcode[i].miss); + } } for (int i = 0; i < 256; i++) { |