Parent

Class/Module Index [+]

Quicksearch

Celluloid::StackDump

Attributes

actors[RW]
threads[RW]

Public Class Methods

new(internal_pool) click to toggle source
# File lib/celluloid/stack_dump.rb, line 72
def initialize(internal_pool)
  @internal_pool = internal_pool

  @actors  = []
  @threads = []

  snapshot
end

Public Instance Methods

snapshot() click to toggle source
# File lib/celluloid/stack_dump.rb, line 81
def snapshot
  @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 91
def snapshot_actor(actor)
  state = ActorState.new
  state.id = actor.object_id

  # TODO: delegate to the behavior
  if actor.behavior.is_a?(Cell)
    state.cell = snapshot_cell(actor.behavior)
  end

  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_cell(behavior) click to toggle source
# File lib/celluloid/stack_dump.rb, line 112
def snapshot_cell(behavior)
  state = CellState.new
  state.subject_id = behavior.subject.object_id
  state.subject_class = behavior.subject.class
  state
end
snapshot_thread(thread) click to toggle source
# File lib/celluloid/stack_dump.rb, line 119
def snapshot_thread(thread)
  ThreadState.new(thread.object_id, thread.backtrace, thread.role)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.