Module: Datadog::Core::Environment::VMCache
- Defined in:
- lib/datadog/core/environment/vm_cache.rb
Overview
Reports Ruby VM cache performance statistics. This currently encompasses cache invalidation counters and is CRuby-specific.
JRuby emulates some CRuby global cache statistics, but they are synthetic and don't provide actionable performance information in the same way CRuby does. TruffleRuby does not have a global runtime cache invalidation cache.
Class Method Summary collapse
- .available? ⇒ Boolean
-
.global_constant_state ⇒ Object
Global constant cache "generation" counter.
-
.global_method_state ⇒ Object
Global method cache "generation" counter.
Class Method Details
.available? ⇒ Boolean
40 41 42 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 40 def available? defined?(::RubyVM) && ::RubyVM.respond_to?(:stat) end |
.global_constant_state ⇒ Object
Global constant cache "generation" counter.
Whenever a constant creation busts the global constant cache this value is incremented. This has a measurable performance impact and thus show be avoided after application warm up.
22 23 24 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 22 def global_constant_state ::RubyVM.stat[:global_constant_state] end |
.global_method_state ⇒ Object
Global method cache "generation" counter.
Whenever a method creation busts the global method cache this value is incremented. This has a measurable performance impact and thus show be avoided after application warm up.
Since Ruby 3.0, the method class is kept on a per-class basis,
largely mitigating global method cache busting. global_method_state
is thus not available since Ruby 3.0.
36 37 38 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 36 def global_method_state ::RubyVM.stat[:global_method_state] end |