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

Update to metababel 1.0.0 interface #159

Merged
merged 9 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 >= 0.0.5], [yes])
AX_RUBY_EXTENSION([metababel >= 0.8.0], [yes])
AX_RUBY_EXTENSION([metababel < 1.0.0], [yes])
DonAurelio marked this conversation as resolved.
Show resolved Hide resolved

# Checks for header files.
AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h])
Expand Down
17 changes: 10 additions & 7 deletions xprof/btx_aggreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
TApplencourt marked this conversation as resolved.
Show resolved Hide resolved
*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<aggreg_t *>(usr_data);
delete data;
}

static void finalize_processing_callback(void *btx_handle, void *usr_data) {
auto *data = static_cast<aggreg_t *>(usr_data);
// Host
for (const auto &[hptb_function_name, t] : data->host) {
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions xprof/btx_tally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void print_metadata(std::vector<std::string> 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;
Expand All @@ -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<tally_dispatch_t *>(usr_data);
data->params = usr_params;
Expand All @@ -209,7 +209,7 @@ static void read_params_callaback(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<tally_dispatch_t *>(usr_data);

Expand Down Expand Up @@ -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_read_params(btx_handle, &read_params_callaback);
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_read_params(btx_handle, &read_params_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);
Expand Down
9 changes: 4 additions & 5 deletions xprof/btx_timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<timeline_dispatch_t *>(usr_data);
for (auto &[uuid, s] : dispatch->uuid2stack) {
while (!s.empty()) {
Expand Down Expand Up @@ -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_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_component_callback);
btx_register_callbacks_finalize_component(btx_handle, &btx_finalize_component_callback);
}
Loading