diff options
author | Mark Shannon <mark@hotpy.org> | 2022-02-01 15:05:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 15:05:18 (GMT) |
commit | 48be46ec1f3f8010570165daa1da4bf9961f3a83 (patch) | |
tree | 03c3f5810599572799b4645477622af83aa30ba2 /Include/internal/pycore_code.h | |
parent | 913e340a323c7e61ae6e4acbb1312b4342657bec (diff) | |
download | cpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.zip cpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.tar.gz cpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.tar.bz2 |
bpo-46072: Add some object layout and allocation stats (GH-31051)
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r-- | Include/internal/pycore_code.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 68b536f..45c7752 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -305,9 +305,19 @@ typedef struct _call_stats { uint64_t pyeval_calls; } CallStats; +typedef struct _object_stats { + uint64_t allocations; + uint64_t frees; + uint64_t new_values; + uint64_t dict_materialized_on_request; + uint64_t dict_materialized_new_key; + uint64_t dict_materialized_too_big; +} ObjectStats; + typedef struct _stats { OpcodeStats opcode_stats[256]; CallStats call_stats; + ObjectStats object_stats; } PyStats; extern PyStats _py_stats; @@ -316,6 +326,7 @@ extern PyStats _py_stats; #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++ +#define OBJECT_STAT_INC(name) _py_stats.object_stats.name++ void _Py_PrintSpecializationStats(int to_file); @@ -326,6 +337,7 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); #define STAT_DEC(opname, name) ((void)0) #define OPCODE_EXE_INC(opname) ((void)0) #define CALL_STAT_INC(name) ((void)0) +#define OBJECT_STAT_INC(name) ((void)0) #endif |