Class: Ragweed::Wraposx::ThreadInfo::SchedTimeshare

Inherits:
FFI::Struct
  • Object
show all
Includes:
FFIStructInclude
Defined in:
lib/ragweed/wraposx/thread_info.rb

Overview

struct policy_timeshare_info

int            max_priority;
int           base_priority;
int            cur_priority;
boolean_t         depressed;
int        depress_priority;

;

Instance Method Summary collapse

Methods included from FFIStructInclude

#method_missing, #methods, #respond_to?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ragweed::FFIStructInclude

Instance Method Details

#dump(&block) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ragweed/wraposx/thread_info.rb', line 86

def dump(&block)
  maybe_hex = lambda {|a| begin; "\n" + (" " * 9) + block.call(a, 16).hexdump(true)[10..-2]; rescue; ""; end }

  string =<<EOM
  -----------------------------------------------------------------------
  Timeshare Info:
  max_priority:     #{self.max_priority.to_s.rjust(8, "0")} #{maybe_hex.call(self.max_priority)}
  base_priority:    #{self.base_priority.to_s.rjust(8, "0")} #{maybe_hex.call(self.base_priority)}
  cur_priority:     #{self.cpu_usage.to_s.rjust(8, "0")} #{maybe_hex.call(self.cur_priority)}
  depressed:        #{(!self.depressed.zero?).to_s.rjust(8, " ")} #{maybe_hex.call(self.depressed)}
  depress_priority: #{self.depress_priority.to_s.rjust(8, "0")} #{maybe_hex.call(self.depressed_priority)}
EOM
end