class Datadog::Profiling::Buffer

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.

Public Class Methods

new(*args) click to toggle source
Calls superclass method Datadog::ThreadSafeBuffer::new
# File lib/ddtrace/profiling/buffer.rb, line 11
def initialize(*args)
  super
  @caches = {}
  @string_table = Utils::StringTable.new
end

Public Instance Methods

cache(cache_name) click to toggle source
# File lib/ddtrace/profiling/buffer.rb, line 17
def cache(cache_name)
  synchronize do
    @caches[cache_name] ||= Utils::ObjectSet.new
  end
end
string_table() click to toggle source
# File lib/ddtrace/profiling/buffer.rb, line 23
def string_table
  synchronize do
    @string_table
  end
end

Protected Instance Methods

drain!() click to toggle source
Calls superclass method Datadog::Buffer#drain!
# File lib/ddtrace/profiling/buffer.rb, line 31
def drain!
  items = super

  # Clear caches
  @caches = {}
  @string_table = Utils::StringTable.new

  items
end