Class: Ragweed::Wraposx::ThreadInfo::Basic
- Includes:
- ThreadInfoMixins
- Defined in:
- lib/ragweed/wraposx/thread_info.rb
Overview
struct thread_basic_info
time_value_t user_time;
time_value_t system_time;
integer_t cpu_usage;
policy_t policy;
integer_t run_state;
integer_t flags;
integer_t suspend_count;
integer_t sleep_time;
;
Defined Under Namespace
Modules: Flags
Constant Summary collapse
- FLAVOR =
Ragweed::Wraposx::ThreadInfo::BASIC_INFO
Instance Attribute Summary collapse
-
#system_time ⇒ Object
Returns the value of attribute system_time.
-
#user_time ⇒ Object
Returns the value of attribute user_time.
Instance Method Summary collapse
- #__refresh ⇒ Object
- #dump(&block) ⇒ Object
-
#refresh(str) ⇒ Object
(re)loads the data from str.
Methods included from ThreadInfoMixins
get, #get, #initialize, #inspect, #to_s
Instance Attribute Details
#system_time ⇒ Object
Returns the value of attribute system_time.
105 106 107 |
# File 'lib/ragweed/wraposx/thread_info.rb', line 105 def system_time @system_time end |
#user_time ⇒ Object
Returns the value of attribute user_time.
104 105 106 |
# File 'lib/ragweed/wraposx/thread_info.rb', line 104 def user_time @user_time end |
Instance Method Details
#__refresh ⇒ Object
106 |
# File 'lib/ragweed/wraposx/thread_info.rb', line 106 alias_method :__refresh, :refresh |
#dump(&block) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/ragweed/wraposx/thread_info.rb', line 126 def dump(&block) maybe_hex = lambda {|a| begin; "\n" + (" " * 9) + block.call(a, 16).hexdump(true)[10..-2]; rescue; ""; end } maybe_dis = lambda {|a| begin; "\n" + block.call(a, 16).distorm.map {|i| " " + i.mnem}.join("\n"); rescue; ""; end } string =<<EOM ----------------------------------------------------------------------- INFO: user_time: #{self.user_time.to_s.rjust(8, "0")} #{maybe_hex.call(self.user_time)} system_time: #{self.system_time.to_s.rjust(8, "0")} #{maybe_hex.call(self.system_time)} cpu_usage: #{self.cpu_usage.to_s.rjust(8, "0")} #{maybe_hex.call(self.cpu_usage)} policy: #{self.policy.to_s.rjust(8, "0")} #{maybe_hex.call(self.policy)} run_state: #{self.run_state.to_s.rjust(8, "0")} #{maybe_hex.call(self.run_state)} suspend_count: #{self.suspend_count.to_s.rjust(8, "0")} #{maybe_hex.call(self.suspend_count)} sleep_time: #{self.sleep_time.to_s.rjust(8, "0")} #{maybe_hex.call(self.sleep_time)} flags: #{self.flags.to_s(2).rjust(32, "0")} #{Flags.flag_dump(self.flags)} EOM end |
#refresh(str) ⇒ Object
(re)loads the data from str
120 121 122 123 124 |
# File 'lib/ragweed/wraposx/thread_info.rb', line 120 def refresh(str) __refresh str @user_time = @user_time_s + (@user_time_us/1000000.0) @system_time = @system_time_s + (@system_time_us/1000000.0) end |