summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-02-01 15:05:18 (GMT)
committerGitHub <noreply@github.com>2022-02-01 15:05:18 (GMT)
commit48be46ec1f3f8010570165daa1da4bf9961f3a83 (patch)
tree03c3f5810599572799b4645477622af83aa30ba2 /Python
parent913e340a323c7e61ae6e4acbb1312b4342657bec (diff)
downloadcpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.zip
cpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.tar.gz
cpython-48be46ec1f3f8010570165daa1da4bf9961f3a83.tar.bz2
bpo-46072: Add some object layout and allocation stats (GH-31051)
Diffstat (limited to 'Python')
-rw-r--r--Python/specialize.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index aec94d9..5771a41 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -172,9 +172,21 @@ print_call_stats(FILE *out, CallStats *stats)
}
static void
+print_object_stats(FILE *out, ObjectStats *stats)
+{
+ fprintf(out, "Object allocations: %" PRIu64 "\n", stats->allocations);
+ fprintf(out, "Object frees: %" PRIu64 "\n", stats->frees);
+ fprintf(out, "Object new values: %" PRIu64 "\n", stats->new_values);
+ fprintf(out, "Object materialize dict (on request): %" PRIu64 "\n", stats->dict_materialized_on_request);
+ fprintf(out, "Object materialize dict (new key): %" PRIu64 "\n", stats->dict_materialized_new_key);
+ fprintf(out, "Object materialize dict (too big): %" PRIu64 "\n", stats->dict_materialized_too_big);
+}
+
+static void
print_stats(FILE *out, PyStats *stats) {
print_spec_stats(out, stats->opcode_stats);
print_call_stats(out, &stats->call_stats);
+ print_object_stats(out, &stats->object_stats);
}
void