Skip to content

Commit

Permalink
Merge branch 'master' into archive
Browse files Browse the repository at this point in the history
  • Loading branch information
TApplencourt authored Jul 24, 2024
2 parents 0bc37e0 + 1e8aa08 commit 66a913a
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions utils/babeltrace_thapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get_and_add_components(graph, names, l_inputs)
graph.add(comp, 'timeline',
params: { 'output_path' => $options[:'output-path'] })
when 'filter.utils.muxer'
graph.add(comp, name) if need_muxer(ARGV.first)
graph.add(comp, name)
when 'filter.btx_aggreg.aggreg'
graph.add(comp, 'aggreg',
params: { 'discard_metadata' => $options[:'discard-metadata'] })
Expand Down Expand Up @@ -281,25 +281,30 @@ def modify_metadata(command, trace)
File.write(File.join($options[:output], THAPI_METADATA_FILE), y.to_yaml)
end

def bt_graphs
@bt_graphs ||= begin
source_comp = if $options[:live]
'source.ctf.lttng_live'
elsif $options[:archive]
def bt_graphs(inputs)
@bt_graphs ||= {}
@bt_graphs[inputs] ||= begin
g_comps = [if $options[:live]
'source.ctf.lttng_live'
elsif $options[:archive]
'source.ctf.lttng_archive'
else
'source.ctf.fs'
end
else
'source.ctf.fs'
end]

{ 'tally' => ['filter.utils.muxer', 'filter.intervals.interval',
if $options[:muxer] || inputs.any? { |trace| thapi_metadata(trace)[:type] == 'lttng' }
g_comps << 'filter.utils.muxer'
end

{ 'tally' => ['filter.intervals.interval',
'filter.btx_aggreg.aggreg', 'sink.btx_tally.tally'],
'timeline' => ['filter.utils.muxer', 'filter.intervals.interval',
'timeline' => ['filter.intervals.interval',
'sink.btx_timeline.timeline'],
'trace' => ['filter.utils.muxer', 'sink.text.rubypretty'],
'to_interval' => ['filter.utils.muxer', 'filter.intervals.interval',
'trace' => ['sink.text.rubypretty'],
'to_interval' => ['filter.intervals.interval',
'filter.btx_stripper.stripper', 'sink.ctf.fs'],
'to_aggreg' => ['filter.utils.muxer', 'filter.intervals.interval', 'filter.btx_aggreg.aggreg',
'filter.btx_stripper.stripper', 'sink.ctf.fs'] }.transform_values { |l| [source_comp] + l }
'to_aggreg' => ['filter.intervals.interval', 'filter.btx_aggreg.aggreg',
'filter.btx_stripper.stripper', 'sink.ctf.fs'] }.transform_values { |l| g_comps + l }
end
end

Expand Down Expand Up @@ -348,10 +353,6 @@ def raise_if_command_invalid(command, trace)
end
end

def need_muxer(trace)
$options[:muxer] || thapi_metadata(trace)[:type] == 'lttng'
end

class BabeltraceParserThapi < OptionParserWithDefaultAndValidation
def initialize
super
Expand Down Expand Up @@ -457,4 +458,4 @@ $options[:'backend-names'] = $options[:backends].map { |name_level| name_level.s
#
# Setup Logger
LOGGER = Logger.new($stdout)
create_and_run_graph(command, bt_graphs[command], ARGV)
create_and_run_graph(command, bt_graphs(ARGV)[command], ARGV)

0 comments on commit 66a913a

Please sign in to comment.