summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2021-08-26 16:11:15 +0200
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commitb5a0baf1c0f969bba966ca0791f27487de5b1067 (patch)
treea42a3d480d85df92d605ef86b33115af80924ccb /yjit.rb
parent924e3ca84fba717f03bea7a4636f623f8e24b484 (diff)
Allow to toggle YJIT stats collection from runtime
For use cases where you want to collect the metrics for a specific piece of code (typically a web request) you can have the stats turned off by default and then turn them on at runtime before executing the code you care about.
Diffstat (limited to 'yjit.rb')
-rw-r--r--yjit.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/yjit.rb b/yjit.rb
index afd1071250..9556f07ad6 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -134,6 +134,14 @@ module YJIT
Primitive.reset_stats_bang
end
+ def self.stats_enabled?
+ Primitive.cexpr! 'rb_yjit_opts.gen_stats ? Qtrue : Qfalse'
+ end
+
+ def self.stats_enabled=(enabled)
+ Primitive.set_stats_enabled(enabled)
+ end
+
def self.enabled?
Primitive.cexpr! 'rb_yjit_enabled_p() ? Qtrue : Qfalse'
end