Class: Cache::Object::DTraceProvider
- Inherits:
-
Object
- Object
- Cache::Object::DTraceProvider
- Defined in:
- lib/cache/object/dtrace_provider.rb
Instance Attribute Summary collapse
-
#probes ⇒ Object
readonly
Returns the value of attribute probes.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DTraceProvider
constructor
A new instance of DTraceProvider.
Constructor Details
#initialize ⇒ DTraceProvider
Returns a new instance of DTraceProvider.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cache/object/dtrace_provider.rb', line 8 def initialize @provider = USDT::Provider.create(:ruby, :cache_object) @probes = { # args: Class name, id, ttl fetch: provider.probe(:adapter, :fetch, :string, :string, :string), # args: Class name, id, ttl fetch_miss: provider.probe(:adapter, :fetch_miss, :string, :string, :string), # args: Class name, attributes.inspect, ttl fetch_mapping: provider.probe(:adapter, :fetch_mapping, :string, :string, :string), # args: Class name, attributes.inspect, ttl fetch_mapping_miss: provider.probe(:adapter, :fetch_mapping_miss, :string, :string, :string), # args: args.inspect, hits, misses read_multi: provider.probe(:adapter, :read_multi, :string, :integer, :integer), # args: class_name, id, ttl write: provider.probe(:adapter, :write, :string, :string, :string), # args: class_name, id delete: provider.probe(:adapter, :delete, :string, :string) } end |
Instance Attribute Details
#probes ⇒ Object (readonly)
Returns the value of attribute probes.
6 7 8 |
# File 'lib/cache/object/dtrace_provider.rb', line 6 def probes @probes end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
6 7 8 |
# File 'lib/cache/object/dtrace_provider.rb', line 6 def provider @provider end |
Class Method Details
.fire!(probe_name, *args) ⇒ Object
35 36 37 38 39 |
# File 'lib/cache/object/dtrace_provider.rb', line 35 def self.fire!(probe_name, *args) raise "Unknown probe: #{probe_name}" unless self.provider.probes[probe_name] probe = self.provider.probes[probe_name] probe.fire(*args) if probe.enabled? end |
.provider ⇒ Object
29 30 31 32 33 |
# File 'lib/cache/object/dtrace_provider.rb', line 29 def self.provider @provider ||= new.tap do |p| p.provider.enable end end |