diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-04-08 15:18:18 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:33 -0400 |
commit | 032b2ecf4b026d2945659d8de325ad3ef6ad4734 (patch) | |
tree | 7b4d3659de9db82de1c5ea9054793695e2b93f05 | |
parent | 7108da16e9ec39d682572c47ac3e99035c0683f0 (diff) |
Compute percentage of exits for top-10 exit ops
-rw-r--r-- | yjit_iface.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/yjit_iface.c b/yjit_iface.c index 1ac36b8cf2..4116e526d8 100644 --- a/yjit_iface.c +++ b/yjit_iface.c @@ -829,17 +829,21 @@ print_insn_count_buffer(int how_many, int left_pad) // Sort the exit ops by decreasing frequency const struct insn_count *sorted_exit_ops = sort_insn_count_array(exit_op_count); - // Compute the longest instruction name + // Compute the longest instruction name and top10_exit_count size_t longest_insn_len = 0; + size_t top10_exit_count = 0; for (int i = 0; i < how_many; i++) { const char *instruction_name = insn_name(sorted_exit_ops[i].insn); size_t len = strlen(instruction_name); if (len > longest_insn_len) { longest_insn_len = len; } + top10_exit_count += sorted_exit_ops[i].count; } - fprintf(stderr, "most frequent exit op:\n"); + double top10_exit_percent = 100.0 * top10_exit_count / total_exit_count; + + fprintf(stderr, "top-%d most frequent exit ops (%.1f%% of exits):\n", how_many, top10_exit_percent); // Print the top-N most frequent exit counts for (int i = 0; i < how_many; i++) { |