Commit ce4058ca authored by Brice Videau's avatar Brice Videau
Browse files

Added basic tools to dump babeltrace2 trace format.

parent 4a37710b
Pipeline #12961 canceled with stage
......@@ -111,6 +111,9 @@ libTracerOpenCL_la_LDFLAGS += -Wl,--version-script,$(srcdir)/tracer_opencl.map -
libTracerOpenCL_la_DEPENDS = $(srcdir)/tracer_opencl.map
libTracerOpenCL_la_LIBADD = libtracepoints.la
thapi_session: libTracerOpenCL.la
$(top_srcdir)/utils/lttng_dummy_trace.sh ./.libs/libTracerOpenCL.so lttng_ust_opencl:\*,lttng_ust_opencl_build:\*,lttng_ust_opencl_arguments:\*,lttng_ust_opencl_dump:\*,lttng_ust_opencl_profiling:\*,lttng_ust_opencl_source:\*,lttng_ust_opencl_devices:\*
install-exec-hook:
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/opencl
$(LN_S) -f $(DESTDIR)$(libdir)/libTracerOpenCL.so.1.0.0 $(DESTDIR)$(pkglibdir)/opencl/libOpenCL.so.1
......
require 'babeltrace2'
require 'yaml'
require 'find'
require 'set'
path = ARGV[0]
trace_location = Find.find(path).select { |f|
File.basename(f) == "metadata" }.collect { |f|
File.dirname(f)
}.uniq
graph = BT2::BTGraph.new
ctf_fs = BT2::BTPlugin.find("ctf").get_source_component_class_by_name("fs")
utils_muxer = BT2::BTPlugin.find("utils").get_filter_component_class_by_name("muxer")
printed = false
comp1 = graph.add(ctf_fs, "trace", params: {"inputs" => trace_location})
comp2 = graph.add(utils_muxer, "mux")
comp3 = graph.add_simple_sink("print", lambda { |iterator, _|
mess = iterator.next_messages
mess.each { |m|
if !printed
puts YAML.dump(m.stream.get_class.trace_class.to_h)
printed = true
end
}
})
comp1.output_ports.each_with_index { |op, i|
ip = comp2.input_port(i)
graph.connect_ports(op, ip)
}
graph.connect_ports(comp2.output_port(0), comp3.input_port(0))
graph.run
#!/bin/sh
lttng-sessiond --daemonize --quiet
lttng create thapi-session --output=./thapi-session
lttng enable-channel --userspace --blocking-timeout=inf blocking-channel
lttng add-context --userspace --channel=blocking-channel -t vpid -t vtid
lttng enable-event --channel=blocking-channel --userspace $2
lttng start
LD_PRELOAD=$1 rm
lttng stop
lttng destroy
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment