diff options
author | Mark Shannon <mark@hotpy.org> | 2022-01-28 15:20:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 15:20:33 (GMT) |
commit | 90ab138bbdc63763ad825ed6d4821367c09c4015 (patch) | |
tree | 3adaef410013002de2e488d9c37fb6abc3462082 /Include/internal | |
parent | 9a241271139a317597aca71d5971346b2cfe7dbd (diff) | |
download | cpython-90ab138bbdc63763ad825ed6d4821367c09c4015.zip cpython-90ab138bbdc63763ad825ed6d4821367c09c4015.tar.gz cpython-90ab138bbdc63763ad825ed6d4821367c09c4015.tar.bz2 |
bpo-46072: Add simple stats for Python calls. (GH-30989)
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_code.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 71dfe3e..68b536f 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -300,8 +300,14 @@ typedef struct _opcode_stats { uint64_t pair_count[256]; } OpcodeStats; +typedef struct _call_stats { + uint64_t inlined_py_calls; + uint64_t pyeval_calls; +} CallStats; + typedef struct _stats { OpcodeStats opcode_stats[256]; + CallStats call_stats; } PyStats; extern PyStats _py_stats; @@ -309,6 +315,7 @@ extern PyStats _py_stats; #define STAT_INC(opname, name) _py_stats.opcode_stats[opname].specialization.name++ #define STAT_DEC(opname, name) _py_stats.opcode_stats[opname].specialization.name-- #define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[opname].execution_count++ +#define CALL_STAT_INC(name) _py_stats.call_stats.name++ void _Py_PrintSpecializationStats(int to_file); @@ -318,6 +325,7 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); #define STAT_INC(opname, name) ((void)0) #define STAT_DEC(opname, name) ((void)0) #define OPCODE_EXE_INC(opname) ((void)0) +#define CALL_STAT_INC(name) ((void)0) #endif |