class Celluloid::StackDump
Attributes
actors[RW]
threads[RW]
Public Class Methods
new()
click to toggle source
# File lib/celluloid/stack_dump.rb, line 62 def initialize @actors = [] @threads = [] snapshot end
Public Instance Methods
dump(output = STDERR)
click to toggle source
# File lib/celluloid/stack_dump.rb, line 100 def dump(output = STDERR) @actors.each do |actor| output.print actor.dump end @threads.each do |thread| output.print thread.dump end end
snapshot()
click to toggle source
# File lib/celluloid/stack_dump.rb, line 69 def snapshot Celluloid.internal_pool.each do |thread| if thread.role == :actor @actors << snapshot_actor(thread.actor) if thread.actor else @threads << snapshot_thread(thread) end end end
snapshot_actor(actor)
click to toggle source
# File lib/celluloid/stack_dump.rb, line 79 def snapshot_actor(actor) state = ActorState.new state.subject_id = actor.subject.object_id state.subject_class = actor.subject.class tasks = actor.tasks if tasks.empty? state.status = :idle else state.status = :running state.tasks = tasks.to_a.map { |t| TaskState.new(t.class, t.type, t.meta, t.status, t.backtrace) } end state.backtrace = actor.thread.backtrace if actor.thread state end
snapshot_thread(thread)
click to toggle source
# File lib/celluloid/stack_dump.rb, line 96 def snapshot_thread(thread) ThreadState.new(thread.object_id, thread.backtrace) end