Class: Datadog::Profiling::Buffer

Inherits:
Core::Buffer::ThreadSafe show all
Defined in:
lib/datadog/profiling/buffer.rb

Overview

Profiling buffer that stores profiling events. The buffer has a maximum size and when the buffer is full, a random event is discarded. This class is thread-safe.

Instance Method Summary collapse

Methods inherited from Core::Buffer::ThreadSafe

#close, #concat, #empty?, #length, #pop, #push, #synchronize

Methods inherited from Core::Buffer::Random

#close, #closed?, #concat, #empty?, #length, #pop, #push

Constructor Details

#initialize(*args) ⇒ Buffer

Returns a new instance of Buffer.



12
13
14
15
16
# File 'lib/datadog/profiling/buffer.rb', line 12

def initialize(*args)
  super
  @caches = {}
  @string_table = Core::Utils::StringTable.new
end

Instance Method Details

#cache(cache_name) ⇒ Object



18
19
20
21
22
# File 'lib/datadog/profiling/buffer.rb', line 18

def cache(cache_name)
  synchronize do
    @caches[cache_name] ||= Core::Utils::ObjectSet.new
  end
end

#string_tableObject



24
25
26
27
28
# File 'lib/datadog/profiling/buffer.rb', line 24

def string_table
  synchronize do
    @string_table
  end
end