Class: Datadog::Profiling::Buffer

Inherits:
ThreadSafeBuffer show all
Defined in:
lib/ddtrace/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 ThreadSafeBuffer

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

Methods inherited from Buffer

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

Constructor Details

#initialize(*args) ⇒ Buffer

Returns a new instance of Buffer.



11
12
13
14
15
# File 'lib/ddtrace/profiling/buffer.rb', line 11

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

Instance Method Details

#cache(cache_name) ⇒ Object



17
18
19
20
21
# File 'lib/ddtrace/profiling/buffer.rb', line 17

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

#string_tableObject



23
24
25
26
27
# File 'lib/ddtrace/profiling/buffer.rb', line 23

def string_table
  synchronize do
    @string_table
  end
end