From 291cb5a8dec51ba3b42a726fadae37da29209883 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 30 Oct 2023 18:38:15 +0000 Subject: [PATCH 1/8] update to metababel 1.0.0 interface --- xprof/btx_aggreg.cpp | 17 ++++++++++------- xprof/btx_tally.cpp | 4 ++-- xprof/btx_timeline.cpp | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/xprof/btx_aggreg.cpp b/xprof/btx_aggreg.cpp index d340f340..965455ae 100644 --- a/xprof/btx_aggreg.cpp +++ b/xprof/btx_aggreg.cpp @@ -17,11 +17,16 @@ struct aggreg_s { }; using aggreg_t = struct aggreg_s; -static void initialize_usr_data_callback(void *btx_handle, void **usr_data) { +static void initialize_component_callback(void *btx_handle, void **usr_data) { *usr_data = new aggreg_t; } -static void finalize_usr_data_callback(void *btx_handle, void *usr_data) { +static void finalize_component_callback(void *btx_handle, void *usr_data) { + auto *data = static_cast(usr_data); + delete data; +} + +static void finalize_processing_callback(void *btx_handle, void *usr_data) { auto *data = static_cast(usr_data); // Host for (const auto &[hptb_function_name, t] : data->host) { @@ -42,8 +47,6 @@ static void finalize_usr_data_callback(void *btx_handle, void *usr_data) { btx_push_message_aggreg_device(btx_handle, hostname.c_str(), vpid, vtid, name.c_str(), t.min, t.max, t.duration, t.count, did, sdid, metadata.c_str()); } - - delete data; } static void host_usr_callback(void *btx_handle, void *usr_data, const char *hostname, int64_t vpid, @@ -71,9 +74,9 @@ static void device_usr_callback(void *btx_handle, void *usr_data, const char *ho } void btx_register_usr_callbacks(void *btx_handle) { - - btx_register_callbacks_initialize_usr_data(btx_handle, &initialize_usr_data_callback); - btx_register_callbacks_finalize_usr_data(btx_handle, &finalize_usr_data_callback); + btx_register_callbacks_initialize_component(btx_handle, &initialize_component_callback); + btx_register_callbacks_finalize_processing(btx_handle, &finalize_processing_callback); + btx_register_callbacks_finalize_component(btx_handle, &finalize_component_callback); btx_register_callbacks_lttng_host(btx_handle, &host_usr_callback); btx_register_callbacks_lttng_traffic(btx_handle, &traffic_usr_callback); diff --git a/xprof/btx_tally.cpp b/xprof/btx_tally.cpp index 940f7cb8..30c39f42 100644 --- a/xprof/btx_tally.cpp +++ b/xprof/btx_tally.cpp @@ -345,9 +345,9 @@ static void ust_thapi_metadata_usr_callback(void *btx_handle, void *usr_data, co } void btx_register_usr_callbacks(void *btx_handle) { - btx_register_callbacks_initialize_usr_data(btx_handle, &initialize_usr_data_callback); + btx_register_callbacks_initialize_component(btx_handle, &initialize_usr_data_callback); btx_register_callbacks_read_params(btx_handle, &read_params_callaback); - btx_register_callbacks_finalize_usr_data(btx_handle, &finalize_usr_data_callback); + btx_register_callbacks_finalize_component(btx_handle, &finalize_usr_data_callback); btx_register_callbacks_lttng_device_name(btx_handle, &device_name_usr_callback); btx_register_callbacks_lttng_ust_thapi_metadata(btx_handle, &ust_thapi_metadata_usr_callback); diff --git a/xprof/btx_timeline.cpp b/xprof/btx_timeline.cpp index 0c9f3d0d..378d6667 100644 --- a/xprof/btx_timeline.cpp +++ b/xprof/btx_timeline.cpp @@ -357,6 +357,6 @@ void btx_register_usr_callbacks(void *btx_handle) { btx_register_callbacks_lttng_device(btx_handle, &device_usr_callback); btx_register_callbacks_lttng_frequency(btx_handle, &frequency_usr_callback); btx_register_callbacks_lttng_power(btx_handle, &power_usr_callback); - btx_register_callbacks_initialize_usr_data(btx_handle, &btx_initialize_usr_data); - btx_register_callbacks_finalize_usr_data(btx_handle, &btx_finalize_usr_data); + btx_register_callbacks_initialize_component(btx_handle, &btx_initialize_usr_data); + btx_register_callbacks_finalize_component(btx_handle, &btx_finalize_usr_data); } From e436d75485c4eccbf0c0aaa5ac1ee71ce6140a9b Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 30 Oct 2023 18:43:36 +0000 Subject: [PATCH 2/8] check metababel version 1.0.0 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c086b58f..b0d4f50f 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,7 @@ PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 3.0]) AX_RUBY_EXTENSION([cast-to-yaml], [yes]) AX_RUBY_EXTENSION([nokogiri], [yes]) AX_RUBY_EXTENSION([babeltrace2], [yes]) -AX_RUBY_EXTENSION([metababel >= 0.0.5], [yes]) +AX_RUBY_EXTENSION([metababel >= 1.0.0], [yes]) # Checks for header files. AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h]) From b583ab10e5a30bade4d07aeb1d242156e4b0a36c Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 30 Oct 2023 18:45:19 +0000 Subject: [PATCH 3/8] typo --- xprof/btx_tally.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xprof/btx_tally.cpp b/xprof/btx_tally.cpp index 30c39f42..4e5aa255 100644 --- a/xprof/btx_tally.cpp +++ b/xprof/btx_tally.cpp @@ -190,7 +190,7 @@ static void initialize_usr_data_callback(void *btx_handle, void **usr_data) { }; } -static void read_params_callaback(void *btx_handle, void *usr_data, btx_params_t *usr_params) { +static void read_params_callback(void *btx_handle, void *usr_data, btx_params_t *usr_params) { auto *data = static_cast(usr_data); data->params = usr_params; @@ -346,7 +346,7 @@ static void ust_thapi_metadata_usr_callback(void *btx_handle, void *usr_data, co void btx_register_usr_callbacks(void *btx_handle) { btx_register_callbacks_initialize_component(btx_handle, &initialize_usr_data_callback); - btx_register_callbacks_read_params(btx_handle, &read_params_callaback); + btx_register_callbacks_read_params(btx_handle, &read_params_callback); btx_register_callbacks_finalize_component(btx_handle, &finalize_usr_data_callback); btx_register_callbacks_lttng_device_name(btx_handle, &device_name_usr_callback); From 7067df56ea758c20bae084f77e4c9c6b8be7d2f8 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Mon, 30 Oct 2023 21:41:41 +0000 Subject: [PATCH 4/8] update to metababel 1.0.0 --- xprof/btx_tally.cpp | 8 ++++---- xprof/btx_timeline.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/xprof/btx_tally.cpp b/xprof/btx_tally.cpp index 4e5aa255..c3a50c53 100644 --- a/xprof/btx_tally.cpp +++ b/xprof/btx_tally.cpp @@ -173,7 +173,7 @@ static void print_metadata(std::vector metadata) { std::cout << value << std::endl; } -static void initialize_usr_data_callback(void *btx_handle, void **usr_data) { +static void initialize_component_callback(void *btx_handle, void **usr_data) { /* User allocates its own data structure */ auto *data = new tally_dispatch_t; *usr_data = data; @@ -209,7 +209,7 @@ static void read_params_callback(void *btx_handle, void *usr_data, btx_params_t } } -static void finalize_usr_data_callback(void *btx_handle, void *usr_data) { +static void finalize_component_callback(void *btx_handle, void *usr_data) { auto *data = static_cast(usr_data); @@ -345,9 +345,9 @@ static void ust_thapi_metadata_usr_callback(void *btx_handle, void *usr_data, co } void btx_register_usr_callbacks(void *btx_handle) { - btx_register_callbacks_initialize_component(btx_handle, &initialize_usr_data_callback); + btx_register_callbacks_initialize_component(btx_handle, &initialize_component_callback); btx_register_callbacks_read_params(btx_handle, &read_params_callback); - btx_register_callbacks_finalize_component(btx_handle, &finalize_usr_data_callback); + btx_register_callbacks_finalize_component(btx_handle, &finalize_component_callback); btx_register_callbacks_lttng_device_name(btx_handle, &device_name_usr_callback); btx_register_callbacks_lttng_ust_thapi_metadata(btx_handle, &ust_thapi_metadata_usr_callback); diff --git a/xprof/btx_timeline.cpp b/xprof/btx_timeline.cpp index 378d6667..b2cf6616 100644 --- a/xprof/btx_timeline.cpp +++ b/xprof/btx_timeline.cpp @@ -297,12 +297,11 @@ static void add_event_async(timeline_dispatch_t *dispatch, std::string hostname, add_event_end(dispatch, track_uuid, end); } -void btx_initialize_usr_data(void *btx_handle, void **usr_data) { - +void btx_initialize_component_callback(void *btx_handle, void **usr_data) { *usr_data = new timeline_dispatch_t; } -void btx_finalize_usr_data(void *btx_handle, void *usr_data) { +void btx_finalize_component_callback(void *btx_handle, void *usr_data) { auto *dispatch = static_cast(usr_data); for (auto &[uuid, s] : dispatch->uuid2stack) { while (!s.empty()) { @@ -357,6 +356,6 @@ void btx_register_usr_callbacks(void *btx_handle) { btx_register_callbacks_lttng_device(btx_handle, &device_usr_callback); btx_register_callbacks_lttng_frequency(btx_handle, &frequency_usr_callback); btx_register_callbacks_lttng_power(btx_handle, &power_usr_callback); - btx_register_callbacks_initialize_component(btx_handle, &btx_initialize_usr_data); - btx_register_callbacks_finalize_component(btx_handle, &btx_finalize_usr_data); + btx_register_callbacks_initialize_component(btx_handle, &btx_initialize_component_callback); + btx_register_callbacks_finalize_component(btx_handle, &btx_finalize_component_callback); } From cadec65d749b512d3c86b44452928767c04203d5 Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 31 Oct 2023 16:05:43 +0000 Subject: [PATCH 5/8] enforce metababel versio --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b0d4f50f..30fdc44b 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,8 @@ PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 3.0]) AX_RUBY_EXTENSION([cast-to-yaml], [yes]) AX_RUBY_EXTENSION([nokogiri], [yes]) AX_RUBY_EXTENSION([babeltrace2], [yes]) -AX_RUBY_EXTENSION([metababel >= 1.0.0], [yes]) +AX_RUBY_EXTENSION([metababel >= 0.8.0], [yes]) +AX_RUBY_EXTENSION([metababel < 1.0.0], [yes]) # Checks for header files. AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h]) From 4b0b5a4af907e2c29688cef5b0ba228211bb7adc Mon Sep 17 00:00:00 2001 From: Aurelio Vivas Date: Tue, 31 Oct 2023 16:44:26 -0500 Subject: [PATCH 6/8] Update configure.ac Co-authored-by: Thomas Applencourt --- configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 30fdc44b..b0d4f50f 100644 --- a/configure.ac +++ b/configure.ac @@ -70,8 +70,7 @@ PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 3.0]) AX_RUBY_EXTENSION([cast-to-yaml], [yes]) AX_RUBY_EXTENSION([nokogiri], [yes]) AX_RUBY_EXTENSION([babeltrace2], [yes]) -AX_RUBY_EXTENSION([metababel >= 0.8.0], [yes]) -AX_RUBY_EXTENSION([metababel < 1.0.0], [yes]) +AX_RUBY_EXTENSION([metababel >= 1.0.0], [yes]) # Checks for header files. AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h]) From 9914714bfe3b5bcd5266f73d82958f53e704f0bc Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 31 Oct 2023 21:44:40 +0000 Subject: [PATCH 7/8] Update version --- configure.ac | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 30fdc44b..e7d5c542 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([thapi], [0.0.10], [bvideau@anl.gov]) +AC_INIT([thapi], [0.0.11], [bvideau@anl.gov]) AC_CONFIG_SRCDIR([opencl/tracer_opencl_helpers.include.c]) AC_CONFIG_HEADERS([utils/config.h]) @@ -70,8 +70,7 @@ PKG_CHECK_MODULES([PROTOBUF], [protobuf >= 3.0]) AX_RUBY_EXTENSION([cast-to-yaml], [yes]) AX_RUBY_EXTENSION([nokogiri], [yes]) AX_RUBY_EXTENSION([babeltrace2], [yes]) -AX_RUBY_EXTENSION([metababel >= 0.8.0], [yes]) -AX_RUBY_EXTENSION([metababel < 1.0.0], [yes]) +AX_RUBY_EXTENSION([metababel >= 1.0.0], [yes]) # Checks for header files. AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h]) From ef920c4fd45a498c84066dcc792f5ee600f6b2b3 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 31 Oct 2023 21:54:01 +0000 Subject: [PATCH 8/8] Fix compinent --- xprof/btx_aggreg.cpp | 4 ++-- xprof/btx_tally.cpp | 6 +++--- xprof/btx_timeline.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xprof/btx_aggreg.cpp b/xprof/btx_aggreg.cpp index 965455ae..5100f611 100644 --- a/xprof/btx_aggreg.cpp +++ b/xprof/btx_aggreg.cpp @@ -17,11 +17,11 @@ struct aggreg_s { }; using aggreg_t = struct aggreg_s; -static void initialize_component_callback(void *btx_handle, void **usr_data) { +static void initialize_component_callback(void **usr_data) { *usr_data = new aggreg_t; } -static void finalize_component_callback(void *btx_handle, void *usr_data) { +static void finalize_component_callback(void *usr_data) { auto *data = static_cast(usr_data); delete data; } diff --git a/xprof/btx_tally.cpp b/xprof/btx_tally.cpp index c3a50c53..eb9f27d6 100644 --- a/xprof/btx_tally.cpp +++ b/xprof/btx_tally.cpp @@ -173,7 +173,7 @@ static void print_metadata(std::vector metadata) { std::cout << value << std::endl; } -static void initialize_component_callback(void *btx_handle, void **usr_data) { +static void initialize_component_callback(void **usr_data) { /* User allocates its own data structure */ auto *data = new tally_dispatch_t; *usr_data = data; @@ -190,7 +190,7 @@ static void initialize_component_callback(void *btx_handle, void **usr_data) { }; } -static void read_params_callback(void *btx_handle, void *usr_data, btx_params_t *usr_params) { +static void read_params_callback(void *usr_data, btx_params_t *usr_params) { auto *data = static_cast(usr_data); data->params = usr_params; @@ -209,7 +209,7 @@ static void read_params_callback(void *btx_handle, void *usr_data, btx_params_t } } -static void finalize_component_callback(void *btx_handle, void *usr_data) { +static void finalize_component_callback(void *usr_data) { auto *data = static_cast(usr_data); diff --git a/xprof/btx_timeline.cpp b/xprof/btx_timeline.cpp index b2cf6616..278a4060 100644 --- a/xprof/btx_timeline.cpp +++ b/xprof/btx_timeline.cpp @@ -297,11 +297,11 @@ static void add_event_async(timeline_dispatch_t *dispatch, std::string hostname, add_event_end(dispatch, track_uuid, end); } -void btx_initialize_component_callback(void *btx_handle, void **usr_data) { +void btx_initialize_component_callback(void **usr_data) { *usr_data = new timeline_dispatch_t; } -void btx_finalize_component_callback(void *btx_handle, void *usr_data) { +void btx_finalize_component_callback(void *usr_data) { auto *dispatch = static_cast(usr_data); for (auto &[uuid, s] : dispatch->uuid2stack) { while (!s.empty()) {