class Satyr::Thread

Thread in a stack trace containing individual stack frames

Private Class Methods

new(pointer) click to toggle source

Private constructor - Thread objects are returned by Stacktrace methods

# File lib/satyr.rb, line 155
def initialize(pointer)
  raise SatyrError, "Invalid structure" if pointer.null?
  @struct = Satyr::FFI::ThreadStruct.new pointer
end

Public Instance Methods

duphash(opts = {}) click to toggle source

Duplication hash for the thread The method takes an option hash with following keys:

  • :frames

    number of frames to use (default 0 means use all)

  • :flags

    bitwise sum of (:normal, :nohash, :nonormalize, :koops_compat)

  • :prefix

    string to be prepended in front of the text before hashing

# File lib/satyr.rb, line 167
def duphash(opts = {})
  opts = {:frames => 0, :flags => :normal, :prefix => ""}.merge(opts)
  str_pointer = Satyr::FFI.sr_thread_get_duphash @struct.to_ptr, opts[:frames], opts[:prefix], opts[:flags]
  raise SatyrError, "Failed to compute duphash" if str_pointer.null?
  hash = str_pointer.read_string.force_encoding('UTF-8')
  Satyr::FFI.free str_pointer
  hash
end