class Object
Constants
- PQ_IMPLEMENTATIONS
- Pocosim
#<RDoc::Comment:0x00000000913d18>
#<RDoc::Comment:0x00000000617ad8>
#<RDoc::Comment:0x00000000d82520>
#<RDoc::Comment:0x00000000ad4648>
#<RDoc::Comment:0x00000000767488>
#<RDoc::Comment:0x00000000d73d18>
#<RDoc::Comment:0x00000000a8aed0>
#<RDoc::Comment:0x00000000d42a10>
#<RDoc::Comment:0x00000000dc7058>
#<RDoc::Comment:0x00000000d76dd8>
#<RDoc::Comment:0x00000000a9f010>
- REPEAT_COUNT
- SAMPLE_COUNT
- STREAM_COUNTS
Public Instance Methods
format_size_details(details, indent = "")
click to toggle source
# File bin/pocolog-decode, line 116 def format_size_details(details, indent = "") details.each_slice(2) do |field_name, field_details| puts "#{indent}#{field_name} #{hr_bytes(field_details.first)}" if field_details.size > 1 format_size_details(field_details[1..-1], indent + " ") end end end
hr_bytes(v)
click to toggle source
Converts a byte count into a human-readable form
# File bin/pocolog-decode, line 10 def hr_bytes(v) if v > 10_000_000 v /= 1_000_000 unit = "M" format = "%i" elsif v > 1_000_000 v /= 1_000_000 unit = "M" format = "%.1f" elsif v > 10000 v /= 1_000 unit = "k" format = "%i" elsif v > 1000 v /= 1_000 unit = "k" format = "%.1f" else unit = "b" format = "%i" end "#{format}#{unit}" % [v] end
simple_type?(type)
click to toggle source
# File bin/pocolog-decode, line 59 def simple_type?(type) if type <= Numeric || type <= String true elsif !type.respond_to?(:<) || !(type < Typelib::Type) raise TypeError, "#{type} is not a typelib Type object" elsif type < Typelib::CompoundType type.each_field do |field_name, field_type| return false if !simple_type?(field_type) end elsif type < Typelib::IndirectType false else true end end
size_details(data)
click to toggle source
# File bin/pocolog-decode, line 75 def size_details(data) result = [data.marshalling_size] return result if simple_type?(data.class) case data when Typelib::CompoundType data.each_field do |name, value| if !simple_type?(value.class) result.concat([name, size_details(value)]) end end when Typelib::ContainerType, Typelib::ArrayType if data.class < Typelib::ContainerType && data.empty? # Nothing to do ... elsif simple_type?(data.class.deference) result.concat(["[0:#{data.size - 1}]", [data.class.deference.size]]) else range = [0, -1] details = nil data.each do |element| element_details = size_details(element) details ||= element_details if element_details == details range[1] += 1 else result.concat([range.map(&:to_s).join(":"), details]) details = element_details range[0] = range[1] = range[1] + 1 end end if details result.concat([range.map(&:to_s).join(":"), details]) end end else raise NotImplementedError, "found sample of type #{data.type} which is not supported" end result end
time_from_spec(spec)
click to toggle source
# File bin/pocolog, line 10 def time_from_spec(spec) if spec =~ /^\d+$/ then Integer(spec) elsif spec =~ /^\d+\.\d+$/ then Time.at(Float(spec)) else Time.parse(spec) end end