Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better muxer #268

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions utils/babeltrace_thapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,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 @@ -276,23 +276,28 @@ 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'
else
'source.ctf.fs'
end
def bt_graphs(inputs)
@bt_graphs ||= {}
@bt_graphs[inputs] ||= begin
g_comps = [if $options[:live]
'source.ctf.lttng_live'
else
'source.ctf.fs'
end]

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

{ 'tally' => ['filter.utils.muxer', 'filter.intervals.interval',
{ '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 @@ -341,10 +346,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 @@ -448,4 +449,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)