Skip to content

Commit

Permalink
Cuda structures (#275)
Browse files Browse the repository at this point in the history
* Use transitive closure to determine struct be_class.

* Do not trace struct content that have differing size between versions.
  • Loading branch information
Kerilk authored Jul 30, 2024
1 parent 726a7bc commit 6148024
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cuda/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ CUDART_MODEL = \
$(top_srcdir)/utils/LTTng.rb \
$(srcdir)/cudart.h.include

cuda_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_cuda_model.rb $(CUDA_MODEL)
cuda_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_cuda_model.rb $(CUDA_MODEL) $(top_srcdir)/utils/gen_babeltrace_model_helper.rb
SRC_DIR=$(srcdir) $(RUBY) $< > $@

CLEANFILES += \
Expand Down
2 changes: 1 addition & 1 deletion hip/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ HIP_MODEL = \
$(top_srcdir)/utils/LTTng.rb \
hip.h.include

hip_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_hip_model.rb $(HIP_MODEL)
hip_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_hip_model.rb $(HIP_MODEL) $(top_srcdir)/utils/gen_babeltrace_model_helper.rb
SRC_DIR=$(srcdir) $(RUBY) $< > $@

CLEANFILES += \
Expand Down
2 changes: 1 addition & 1 deletion mpi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MPI_MODEL = \
$(top_srcdir)/utils/LTTng.rb \
$(MPI_EXTRACTED)

mpi_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_mpi_model.rb $(MPI_MODEL)
mpi_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_mpi_model.rb $(MPI_MODEL) $(top_srcdir)/utils/gen_babeltrace_model_helper.rb
SRC_DIR=$(srcdir) $(RUBY) $< > $@

CLEANFILES += \
Expand Down
1 change: 1 addition & 0 deletions omp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ BTX_OMP_GENERATED = \
btx_filter_omp/btx_main.c

OMP_LIB_GEN = \
$(top_srcdir)/utils/gen_babeltrace_model_helper.rb \
$(top_srcdir)/utils/gen_library_base.rb \
$(srcdir)/gen_omp_library_base.rb \
$(srcdir)/gen_probe_base.rb
Expand Down
17 changes: 9 additions & 8 deletions utils/gen_babeltrace_model_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def get_extra_fields_types_name(event)
}.flatten(1)
end

$types_by_name = $all_types.map { |ty| [ty.name, ty] }.to_h

def gen_bt_field_model(lttng_name, type, name, lttng)
field = { name: name, cast_type: type}
case lttng_name
Expand Down Expand Up @@ -42,16 +44,15 @@ def gen_bt_field_model(lttng_name, type, name, lttng)
field[:length] = lttng.length
when 'ctf_string'
field[:class] = 'string'
when 'ctf_sequence_text'
when 'ctf_sequence_text', 'ctf_array_text'
field[:class] = 'string'
if $all_struct_names.include?(type.sub(" *", ""))
field[:be_class] = to_scoped_class_name(type.sub(" *", ""))
field[:length] = lttng.length if lttng_name == 'ctf_array_text'
t = type.sub(" *", "")
while $types_by_name.include?(t) && $types_by_name[t].type.kind_of?(YAMLCAst::CustomType)
t = $types_by_name[t].type.name
end
when 'ctf_array_text'
field[:class] = 'string'
field[:length] = lttng.length
if $all_struct_names.include?(type.sub(" *", ""))
field[:be_class] = to_scoped_class_name(type.sub(" *", ""))
if $all_struct_names.include?(t)
field[:be_class] = to_scoped_class_name(t)
end
else
raise "unsupported lttng type: #{lttng.inspect}"
Expand Down
1 change: 1 addition & 0 deletions ze/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ install-data-hook:
$(RM) -r $(DESTDIR)$(tmplibdir)

ZE_LIB_GEN = \
$(top_srcdir)/utils/gen_babeltrace_model_helper.rb \
$(top_srcdir)/utils/gen_library_base.rb \
$(srcdir)/gen_ze_library_base.rb \
$(srcdir)/gen_probe_base.rb
Expand Down
4 changes: 0 additions & 4 deletions ze/zel_meta_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
meta_parameters:
zelTracerCreate:
- [ InScalar, desc ]
zelTracerSetPrologues:
- [ InScalar, pCoreCbs ]
zelTracerSetEpilogues:
- [ InScalar, pCoreCbs ]
zelLoaderGetVersions:
- [ InOutScalar, num_elems ]
- [ OutArray, versions, num_elems ]
Expand Down
4 changes: 0 additions & 4 deletions ze/zet_meta_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,3 @@ meta_parameters:
zetTracerExpCreate:
- [ InScalar, desc ]
- [ OutScalar, phTracer ]
zetTracerExpSetPrologues:
- [ InScalar, pCoreCbs ]
zetTracerExpSetEpilogues:
- [ InScalar, pCoreCbs ]

0 comments on commit 6148024

Please sign in to comment.