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
-
.constant_cache_invalidations ⇒ Object
Introduced in Ruby 3.2 to match an improved cache implementation.
-
.constant_cache_misses ⇒ Object
Introduced in Ruby 3.2 to match an improved cache implementation.
-
.global_constant_state ⇒ Object
Global constant cache “generation” counter.
-
.global_method_state ⇒ Object
Global method cache “generation” counter.
Class Method Details
.available? ⇒ Boolean
56 57 58 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 56 def available? defined?(::RubyVM) && ::RubyVM.respond_to?(:stat) end |
.constant_cache_invalidations ⇒ Object
Introduced in Ruby 3.2 to match an improved cache implementation.
45 46 47 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 45 def constant_cache_invalidations ::RubyVM.stat[:constant_cache_invalidations] end |
.constant_cache_misses ⇒ Object
Introduced in Ruby 3.2 to match an improved cache implementation.
52 53 54 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 52 def constant_cache_misses ::RubyVM.stat[:constant_cache_misses] 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.
This was removed in Ruby 3.2.
24 25 26 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 24 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.
38 39 40 |
# File 'lib/datadog/core/environment/vm_cache.rb', line 38 def global_method_state ::RubyVM.stat[:global_method_state] end |