mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
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.
This commit is contained in:
parent
c6fe0869ab
commit
84b4533e84
5 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue