Class: Celluloid::StackDump

### Home Classes Methods

### In Files

- lib/celluloid/stack_dump.rb

### Parent

Object

### Namespace

- MODULE Celluloid::StackDump::DisplayBacktrace
- CLASS Celluloid::StackDump::ActorState
- CLASS Celluloid::StackDump::CellState
- CLASS Celluloid::StackDump::TaskState
- CLASS Celluloid::StackDump::ThreadState

### Methods

- ::new
- #print
- #snapshot
- #snapshot_actor
- #snapshot_cell
- #snapshot_thread

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::AbortError
- Celluloid::AbstractProxy
- Celluloid::Actor
- Celluloid::Actor::Sleeper
- Celluloid::ActorProxy
- Celluloid::ActorSystem
- Celluloid::AsyncCall
- Celluloid::AsyncProxy
- Celluloid::BlockCall
- Celluloid::BlockProxy
- Celluloid::BlockResponse
- Celluloid::CPUCounter
- Celluloid::Call
- Celluloid::CallChain
- Celluloid::Cell
- Celluloid::Cell::ExitHandler
- Celluloid::CellProxy
- Celluloid::ClassMethods
- Celluloid::Condition
- Celluloid::Condition::Waiter
- Celluloid::ConditionError
- Celluloid::DeadTaskError
- Celluloid::ErrorResponse
- Celluloid::EventedMailbox
- Celluloid::ExitEvent
- Celluloid::FSM
- Celluloid::FSM::ClassMethods
- Celluloid::FSM::State
- Celluloid::FSM::UnattachedError
- Celluloid::FiberStackError
- Celluloid::Future
- Celluloid::Future::Result
- Celluloid::FutureProxy
- Celluloid::Handler
- Celluloid::Handlers
- Celluloid::Incident
- Celluloid::IncidentLogger
- Celluloid::IncidentLogger::Severity
- Celluloid::IncidentReporter
- Celluloid::IncidentReporter::Formatter
- Celluloid::InstanceMethods
- Celluloid::InternalPool
- Celluloid::LinkingRequest
- Celluloid::LinkingResponse
- Celluloid::Links
- Celluloid::LogEvent
- Celluloid::Logger
- Celluloid::Logger::WithBacktrace
- Celluloid::Mailbox
- Celluloid::MailboxDead
- Celluloid::MailboxShutdown
- Celluloid::Method
- Celluloid::NamingRequest
- Celluloid::NotTaskError
- Celluloid::Notifications
- Celluloid::Notifications::Fanout
- Celluloid::Notifications::Subscriber
- Celluloid::PoolManager
- Celluloid::Probe
- Celluloid::Properties
- Celluloid::Receiver
- Celluloid::Receivers
- Celluloid::Registry
- Celluloid::Response
- Celluloid::ResumableError
- Celluloid::RingBuffer
- Celluloid::SignalConditionRequest
- Celluloid::Signals
- Celluloid::StackDump
- Celluloid::StackDump::ActorState
- Celluloid::StackDump::CellState
- Celluloid::StackDump::DisplayBacktrace
- Celluloid::StackDump::TaskState
- Celluloid::StackDump::ThreadState
- Celluloid::SuccessResponse
- Celluloid::SupervisionGroup
- Celluloid::SupervisionGroup::Member
- Celluloid::Supervisor
- Celluloid::SyncCall
- Celluloid::SyncProxy
- Celluloid::SystemEvent
- Celluloid::Task
- Celluloid::Task::TerminatedError
- Celluloid::Task::TimeoutError
- Celluloid::TaskFiber
- Celluloid::TaskSet
- Celluloid::TaskThread
- Celluloid::TerminationRequest
- Celluloid::Thread
- Celluloid::ThreadHandle
- Celluloid::UUID
- org
- org::jruby
- org::jruby::ext
- org::jruby::ext::fiber
- org::jruby::ext::fiber::ThreadFiber
- Bar
- Baz
- Blocker
- ExampleActorClass
- ExampleCrash
- ExampleMailbox
- ExampleProxy
- ExampleTask
- Fiber
- Foo
- MockActor
- Object
- Thread

No matching classes.

# 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

print(output = STDERR) click to toggle source

    # File lib/celluloid/stack_dump.rb, line 123
    def print(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 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.