mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
GH-109329: Add tier 2 stats (GH-109913)
This commit is contained in:
parent
f7860295b1
commit
e561e98058
9 changed files with 483 additions and 128 deletions
|
|
@ -282,6 +282,17 @@ extern int _PyStaticCode_Init(PyCodeObject *co);
|
|||
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
|
||||
do { if (_Py_stats && PyFunction_Check(callable)) _Py_stats->call_stats.eval_calls[name]++; } while (0)
|
||||
#define GC_STAT_ADD(gen, name, n) do { if (_Py_stats) _Py_stats->gc_stats[(gen)].name += (n); } while (0)
|
||||
#define OPT_STAT_INC(name) do { if (_Py_stats) _Py_stats->optimization_stats.name++; } while (0)
|
||||
#define UOP_EXE_INC(opname) do { if (_Py_stats) _Py_stats->optimization_stats.opcode[opname].execution_count++; } while (0)
|
||||
#define OPT_UNSUPPORTED_OPCODE(opname) do { if (_Py_stats) _Py_stats->optimization_stats.unsupported_opcode[opname]++; } while (0)
|
||||
#define OPT_HIST(length, name) \
|
||||
do { \
|
||||
if (_Py_stats) { \
|
||||
int bucket = _Py_bit_length(length >= 1 ? length - 1 : 0); \
|
||||
bucket = (bucket >= _Py_UOP_HIST_SIZE) ? _Py_UOP_HIST_SIZE - 1 : bucket; \
|
||||
_Py_stats->optimization_stats.name[bucket]++; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Export for '_opcode' shared extension
|
||||
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
|
||||
|
|
@ -296,6 +307,10 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
|
|||
#define EVAL_CALL_STAT_INC(name) ((void)0)
|
||||
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) ((void)0)
|
||||
#define GC_STAT_ADD(gen, name, n) ((void)0)
|
||||
#define OPT_STAT_INC(name) ((void)0)
|
||||
#define UOP_EXE_INC(opname) ((void)0)
|
||||
#define OPT_UNSUPPORTED_OPCODE(opname) ((void)0)
|
||||
#define OPT_HIST(length, name) ((void)0)
|
||||
#endif // !Py_STATS
|
||||
|
||||
// Utility functions for reading/writing 32/64-bit values in the inline caches.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue