class Roby::DRoby::Timepoints::Analysis

Attributes

current_groups[R]
roots[R]
thread_names[R]

Public Class Methods

new() click to toggle source
# File lib/roby/droby/timepoints.rb, line 11
def initialize
    @thread_names = Hash.new
    @roots = roots = Hash.new
    @current_groups = Hash.new do |h, thread_id|
        roots[thread_id] = h[thread_id] = Root.new(thread_id)
    end
end

Public Instance Methods

add(time, thread_id, thread_name, name) click to toggle source
# File lib/roby/droby/timepoints.rb, line 19
def add(time, thread_id, thread_name, name)
    thread_names[thread_id] ||= thread_name
    current_groups[thread_id].add(time, name)
end
flamegraph() click to toggle source
# File lib/roby/droby/timepoints.rb, line 42
def flamegraph
    raw = roots.each_value.map do |root|
        root.flamegraph
    end
    folded = Hash.new(0)
    raw.each_slice(2) do |path, value|
        folded[path] += value
    end
    folded.to_a.sort
end
format(indent: 0, base_time: roots.each_value.map(&:start_time).min, absolute_times: true) click to toggle source
# File lib/roby/droby/timepoints.rb, line 53
def format(indent: 0, base_time: roots.each_value.map(&:start_time).min, absolute_times: true)
    roots.each_value.map do |root|
        root.format(indent: indent, base_time: base_time, absolute_times: absolute_times).
            join("\n")
    end.join("\n")
end
group_end(time, thread_id, thread_name, name) click to toggle source
# File lib/roby/droby/timepoints.rb, line 29
def group_end(time, thread_id, thread_name, name)
    thread_names[thread_id] ||= thread_name
    current_g = current_groups[thread_id]
    if current_g == roots[thread_id]
        raise ArgumentError, "called #group_end on the root group"
    elsif name != current_g.name
        raise ArgumentError, "mismatching name in #group_end"
    end

    current_g = @current_groups[thread_id] = current_g.group
    current_g.group_end(time)
end
group_start(time, thread_id, thread_name, name) click to toggle source
# File lib/roby/droby/timepoints.rb, line 24
def group_start(time, thread_id, thread_name, name)
    thread_names[thread_id] ||= thread_name
    @current_groups[thread_id] = current_groups[thread_id].group_start(time, name)
end