diff options
author | Michael Droettboom <mdboom@gmail.com> | 2023-09-12 21:12:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 21:12:57 (GMT) |
commit | 5dcbbd8861e618488d95416dee8ea94577e3f4f0 (patch) | |
tree | 927dd61ea0134f9cada72b1b28d6b592184ee4e4 /Python/specialize.c | |
parent | 90cf345ed42ae4d17d2a073718985eb3432a7c20 (diff) | |
download | cpython-5dcbbd8861e618488d95416dee8ea94577e3f4f0.zip cpython-5dcbbd8861e618488d95416dee8ea94577e3f4f0.tar.gz cpython-5dcbbd8861e618488d95416dee8ea94577e3f4f0.tar.bz2 |
GH-109330: Dump and compare stats using opcode names, not numbers (GH-109335)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r-- | Python/specialize.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/specialize.c b/Python/specialize.c index 9124341..47e0bd7 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -123,7 +123,7 @@ _Py_GetSpecializationStats(void) { #define PRINT_STAT(i, field) \ if (stats[i].field) { \ - fprintf(out, " opcode[%d]." #field " : %" PRIu64 "\n", i, stats[i].field); \ + fprintf(out, " opcode[%s]." #field " : %" PRIu64 "\n", _PyOpcode_OpName[i], stats[i].field); \ } static void @@ -131,11 +131,11 @@ print_spec_stats(FILE *out, OpcodeStats *stats) { /* Mark some opcodes as specializable for stats, * even though we don't specialize them yet. */ - fprintf(out, "opcode[%d].specializable : 1\n", BINARY_SLICE); - fprintf(out, "opcode[%d].specializable : 1\n", STORE_SLICE); + fprintf(out, "opcode[BINARY_SLICE].specializable : 1\n"); + fprintf(out, "opcode[STORE_SLICE].specializable : 1\n"); for (int i = 0; i < 256; i++) { if (_PyOpcode_Caches[i]) { - fprintf(out, "opcode[%d].specializable : 1\n", i); + fprintf(out, "opcode[%s].specializable : 1\n", _PyOpcode_OpName[i]); } PRINT_STAT(i, specialization.success); PRINT_STAT(i, specialization.failure); @@ -147,14 +147,14 @@ print_spec_stats(FILE *out, OpcodeStats *stats) for (int j = 0; j < SPECIALIZATION_FAILURE_KINDS; j++) { uint64_t val = stats[i].specialization.failure_kinds[j]; if (val) { - fprintf(out, " opcode[%d].specialization.failure_kinds[%d] : %" - PRIu64 "\n", i, j, val); + fprintf(out, " opcode[%s].specialization.failure_kinds[%d] : %" + PRIu64 "\n", _PyOpcode_OpName[i], j, val); } } for (int j = 0; j < 256; j++) { if (stats[i].pair_count[j]) { - fprintf(out, "opcode[%d].pair_count[%d] : %" PRIu64 "\n", - i, j, stats[i].pair_count[j]); + fprintf(out, "opcode[%s].pair_count[%s] : %" PRIu64 "\n", + _PyOpcode_OpName[i], _PyOpcode_OpName[j], stats[i].pair_count[j]); } } } |