Class: Celluloid::Internals::Stack

### Home Classes Methods

### In Files

- lib/celluloid/internals/stack.rb
- lib/celluloid/internals/stack/dump.rb
- lib/celluloid/internals/stack/states.rb
- lib/celluloid/internals/stack/summary.rb

### Parent

Object

### Namespace

- MODULE Celluloid::Internals::Stack::DisplayBacktrace
- CLASS Celluloid::Internals::Stack::ActorState
- CLASS Celluloid::Internals::Stack::CellState
- CLASS Celluloid::Internals::Stack::Dump
- CLASS Celluloid::Internals::Stack::Summary
- CLASS Celluloid::Internals::Stack::TaskState
- CLASS Celluloid::Internals::Stack::ThreadState

### Methods

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

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::Incident
- Celluloid::IncidentLogger
- Celluloid::IncidentLogger::Severity
- Celluloid::IncidentReporter
- Celluloid::IncidentReporter::Formatter
- Celluloid::Internals
- Celluloid::Internals::CPUCounter
- Celluloid::Internals::CallChain
- Celluloid::Internals::Handler
- Celluloid::Internals::Handlers
- Celluloid::Internals::Links
- Celluloid::Internals::Logger
- Celluloid::Internals::Logger::WithBacktrace
- Celluloid::Internals::Method
- Celluloid::Internals::Properties
- Celluloid::Internals::Receiver
- Celluloid::Internals::Receivers
- Celluloid::Internals::Registry
- Celluloid::Internals::Response
- Celluloid::Internals::Response::Block
- Celluloid::Internals::Response::Error
- Celluloid::Internals::Response::Success
- Celluloid::Internals::Signals
- Celluloid::Internals::Stack
- Celluloid::Internals::Stack::ActorState
- Celluloid::Internals::Stack::CellState
- Celluloid::Internals::Stack::DisplayBacktrace
- Celluloid::Internals::Stack::Dump
- Celluloid::Internals::Stack::Summary
- Celluloid::Internals::Stack::TaskState
- Celluloid::Internals::Stack::ThreadState
- Celluloid::Internals::TaskSet
- Celluloid::Internals::ThreadHandle
- Celluloid::Internals::UUID
- Celluloid::LogEvent
- Celluloid::Notifications
- Celluloid::Notifications::Fanout
- Celluloid::Notifications::Subscriber
- Celluloid::Probe
- Celluloid::RingBuffer

No matching classes.

# Celluloid::Internals::Stack

### Attributes

actors[RW]
threads[RW]

### Public Class Methods

new(threads) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 6
    def initialize(threads)
      @group = threads
      @actors  = []
      @threads = []
    end

### Public Instance Methods

print(output = STDERR) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 57
    def print(output = STDERR)
      @actors.each do |actor|
        output.print actor.dump
      end

      @threads.each do |thread|
        output.print thread.dump
      end
    end

snapshot(backtrace=nil) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 12
    def snapshot(backtrace=nil)
      @group.each do |thread|
        if thread.role == :actor
          @actors << snapshot_actor(thread.actor, backtrace) if thread.actor
        else
          @threads << snapshot_thread(thread, backtrace)
        end
      end
    end

snapshot_actor(actor, backtrace=nil) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 22
    def snapshot_actor(actor, backtrace=nil)
      state = ActorState.new
      state.id = actor.object_id

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

      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 backtrace && actor.thread
      state
    end

snapshot_cell(behavior) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 41
    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, backtrace=nil) click to toggle source

    # File lib/celluloid/internals/stack.rb, line 48
    def snapshot_thread(thread, backtrace=nil)
      backtrace = begin
                    thread.backtrace
                  rescue NoMethodError # for Rubinius < 2.5.2.c145
                    []
                  end if backtrace
      ThreadState.new(thread.object_id, backtrace, thread.role)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.