Skip to content

Commit 44faa18

Browse files
authored
Merge pull request #224 from Shopify/compile-stats
Add counters for tracking invalidations
2 parents 85803f5 + a7a7574 commit 44faa18

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

yjit.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ def _print_stats
177177
yjit_ratio_pct = 100.0 * retired_in_yjit.to_f / total_insns_count
178178

179179
$stderr.puts "compiled_iseq_count: " + ("%10d" % stats[:compiled_iseq_count])
180+
$stderr.puts "compiled_block_count: " + ("%10d" % stats[:compiled_block_count])
181+
$stderr.puts "invalidation_count: " + ("%10d" % stats[:invalidation_count])
182+
$stderr.puts "constant_state_bumps: " + ("%10d" % stats[:constant_state_bumps])
180183
$stderr.puts "inline_code_size: " + ("%10d" % stats[:inline_code_size])
181184
$stderr.puts "outlined_code_size: " + ("%10d" % stats[:outlined_code_size])
182185

yjit_core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,10 @@ add_block_version(blockid_t blockid, block_t* block)
558558
RB_OBJ_WRITTEN(iseq, Qundef, object);
559559
}
560560
}
561+
562+
#if YJIT_STATS
563+
yjit_runtime_counters.compiled_block_count++;
564+
#endif
561565
}
562566

563567
// Create a new outgoing branch entry for a block
@@ -1145,6 +1149,10 @@ invalidate_block_version(block_t *block)
11451149

11461150
yjit_free_block(block);
11471151

1152+
#if YJIT_STATS
1153+
yjit_runtime_counters.invalidation_count++;
1154+
#endif
1155+
11481156
// fprintf(stderr, "invalidation done\n");
11491157
}
11501158

yjit_iface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ rb_yjit_constant_state_changed(void)
591591
{
592592
if (blocks_assuming_stable_global_constant_state) {
593593
st_foreach(blocks_assuming_stable_global_constant_state, block_invalidation_iterator, 0);
594+
#if YJIT_STATS
595+
yjit_runtime_counters.constant_state_bumps++;
596+
#endif
594597
}
595598
}
596599

yjit_iface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ YJIT_DECLARE_COUNTERS(
8787

8888
vm_insns_count,
8989
compiled_iseq_count,
90+
compiled_block_count,
91+
invalidation_count,
92+
constant_state_bumps,
9093

9194
expandarray_splat,
9295
expandarray_postarg,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy