#include "lttng/tracker.h"
#define _LGPL_SOURCE
#include "mi-lttng.hpp"
+
#include <common/config/session-config.hpp>
#include <common/defaults.hpp>
#include <common/tracker.hpp>
+
#include <lttng/channel.h>
#include <lttng/snapshot-internal.hpp>
-
#define MI_SCHEMA_MAJOR_VERSION 4
#define MI_SCHEMA_MINOR_VERSION 1
/* Machine interface namespace URI */
-const char * const mi_lttng_xmlns = "xmlns";
-const char * const mi_lttng_xmlns_xsi = "xmlns:xsi";
-const char * const mi_lttng_w3_schema_uri = "http://www.w3.org/2001/XMLSchema-instance";
-const char * const mi_lttng_schema_location = "xsi:schemaLocation";
-const char * const mi_lttng_schema_location_uri =
- DEFAULT_LTTNG_MI_NAMESPACE " "
- "https://lttng.org/xml/schemas/lttng-mi/" XSTR(MI_SCHEMA_MAJOR_VERSION)
- "/lttng-mi-" XSTR(MI_SCHEMA_MAJOR_VERSION) "."
- XSTR(MI_SCHEMA_MINOR_VERSION) ".xsd";
-const char * const mi_lttng_schema_version = "schemaVersion";
-const char * const mi_lttng_schema_version_value = XSTR(MI_SCHEMA_MAJOR_VERSION)
- "." XSTR(MI_SCHEMA_MINOR_VERSION);
+const char *const mi_lttng_xmlns = "xmlns";
+const char *const mi_lttng_xmlns_xsi = "xmlns:xsi";
+const char *const mi_lttng_w3_schema_uri = "http://www.w3.org/2001/XMLSchema-instance";
+const char *const mi_lttng_schema_location = "xsi:schemaLocation";
+const char *const mi_lttng_schema_location_uri = DEFAULT_LTTNG_MI_NAMESPACE
+ " "
+ "https://lttng.org/xml/schemas/lttng-mi/" XSTR(MI_SCHEMA_MAJOR_VERSION) "/lttng-mi-" XSTR(
+ MI_SCHEMA_MAJOR_VERSION) "." XSTR(MI_SCHEMA_MINOR_VERSION) ".xsd";
+const char *const mi_lttng_schema_version = "schemaVersion";
+const char *const mi_lttng_schema_version_value =
+ XSTR(MI_SCHEMA_MAJOR_VERSION) "." XSTR(MI_SCHEMA_MINOR_VERSION);
/* Strings related to command */
-const char * const mi_lttng_element_command = "command";
-const char * const mi_lttng_element_command_action = "snapshot_action";
-const char * const mi_lttng_element_command_add_context = "add-context";
+const char *const mi_lttng_element_command = "command";
+const char *const mi_lttng_element_command_action = "snapshot_action";
+const char *const mi_lttng_element_command_add_context = "add-context";
const char *const mi_lttng_element_command_add_trigger = "add-trigger";
-const char * const mi_lttng_element_command_create = "create";
-const char * const mi_lttng_element_command_destroy = "destroy";
-const char * const mi_lttng_element_command_disable_channel = "disable-channel";
-const char * const mi_lttng_element_command_disable_event = "disable-event";
-const char * const mi_lttng_element_command_enable_channels = "enable-channel";
-const char * const mi_lttng_element_command_enable_event = "enable-event";
-const char * const mi_lttng_element_command_list = "list";
+const char *const mi_lttng_element_command_create = "create";
+const char *const mi_lttng_element_command_destroy = "destroy";
+const char *const mi_lttng_element_command_disable_channel = "disable-channel";
+const char *const mi_lttng_element_command_disable_event = "disable-event";
+const char *const mi_lttng_element_command_enable_channels = "enable-channel";
+const char *const mi_lttng_element_command_enable_event = "enable-event";
+const char *const mi_lttng_element_command_list = "list";
const char *const mi_lttng_element_command_list_trigger = "list-trigger";
-const char * const mi_lttng_element_command_load = "load";
-const char * const mi_lttng_element_command_metadata = "metadata";
-const char * const mi_lttng_element_command_metadata_action = "metadata_action";
-const char * const mi_lttng_element_command_regenerate = "regenerate";
-const char * const mi_lttng_element_command_regenerate_action = "regenerate_action";
-const char * const mi_lttng_element_command_name = "name";
-const char * const mi_lttng_element_command_output = "output";
+const char *const mi_lttng_element_command_load = "load";
+const char *const mi_lttng_element_command_metadata = "metadata";
+const char *const mi_lttng_element_command_metadata_action = "metadata_action";
+const char *const mi_lttng_element_command_regenerate = "regenerate";
+const char *const mi_lttng_element_command_regenerate_action = "regenerate_action";
+const char *const mi_lttng_element_command_name = "name";
+const char *const mi_lttng_element_command_output = "output";
const char *const mi_lttng_element_command_remove_trigger = "remove-trigger";
-const char * const mi_lttng_element_command_save = "save";
-const char * const mi_lttng_element_command_set_session = "set-session";
-const char * const mi_lttng_element_command_snapshot = "snapshot";
-const char * const mi_lttng_element_command_snapshot_add = "add_snapshot";
-const char * const mi_lttng_element_command_snapshot_del = "del_snapshot";
-const char * const mi_lttng_element_command_snapshot_list = "list_snapshot";
-const char * const mi_lttng_element_command_snapshot_record = "record_snapshot";
-const char * const mi_lttng_element_command_start = "start";
-const char * const mi_lttng_element_command_stop = "stop";
-const char * const mi_lttng_element_command_success = "success";
-const char * const mi_lttng_element_command_track = "track";
-const char * const mi_lttng_element_command_untrack = "untrack";
-const char * const mi_lttng_element_command_version = "version";
-const char * const mi_lttng_element_command_rotate = "rotate";
-const char * const mi_lttng_element_command_enable_rotation = "enable-rotation";
-const char * const mi_lttng_element_command_disable_rotation = "disable-rotation";
-const char * const mi_lttng_element_command_clear = "clear";
+const char *const mi_lttng_element_command_save = "save";
+const char *const mi_lttng_element_command_set_session = "set-session";
+const char *const mi_lttng_element_command_snapshot = "snapshot";
+const char *const mi_lttng_element_command_snapshot_add = "add_snapshot";
+const char *const mi_lttng_element_command_snapshot_del = "del_snapshot";
+const char *const mi_lttng_element_command_snapshot_list = "list_snapshot";
+const char *const mi_lttng_element_command_snapshot_record = "record_snapshot";
+const char *const mi_lttng_element_command_start = "start";
+const char *const mi_lttng_element_command_stop = "stop";
+const char *const mi_lttng_element_command_success = "success";
+const char *const mi_lttng_element_command_track = "track";
+const char *const mi_lttng_element_command_untrack = "untrack";
+const char *const mi_lttng_element_command_version = "version";
+const char *const mi_lttng_element_command_rotate = "rotate";
+const char *const mi_lttng_element_command_enable_rotation = "enable-rotation";
+const char *const mi_lttng_element_command_disable_rotation = "disable-rotation";
+const char *const mi_lttng_element_command_clear = "clear";
/* Strings related to version command */
-const char * const mi_lttng_element_version = "version";
-const char * const mi_lttng_element_version_commit = "commit";
-const char * const mi_lttng_element_version_description = "description";
-const char * const mi_lttng_element_version_license = "license";
-const char * const mi_lttng_element_version_major = "major";
-const char * const mi_lttng_element_version_minor = "minor";
-const char * const mi_lttng_element_version_patch_level = "patchLevel";
-const char * const mi_lttng_element_version_str = "string";
-const char * const mi_lttng_element_version_web = "url";
+const char *const mi_lttng_element_version = "version";
+const char *const mi_lttng_element_version_commit = "commit";
+const char *const mi_lttng_element_version_description = "description";
+const char *const mi_lttng_element_version_license = "license";
+const char *const mi_lttng_element_version_major = "major";
+const char *const mi_lttng_element_version_minor = "minor";
+const char *const mi_lttng_element_version_patch_level = "patchLevel";
+const char *const mi_lttng_element_version_str = "string";
+const char *const mi_lttng_element_version_web = "url";
/* String related to a lttng_event_field */
-const char * const mi_lttng_element_event_field = "event_field";
-const char * const mi_lttng_element_event_fields = "event_fields";
+const char *const mi_lttng_element_event_field = "event_field";
+const char *const mi_lttng_element_event_fields = "event_fields";
/* String related to lttng_event_perf_counter_ctx */
-const char * const mi_lttng_element_perf_counter_context = "perf";
+const char *const mi_lttng_element_perf_counter_context = "perf";
/* Strings related to pid */
-const char * const mi_lttng_element_pid_id = "id";
+const char *const mi_lttng_element_pid_id = "id";
/* Strings related to save command */
-const char * const mi_lttng_element_save = "save";
+const char *const mi_lttng_element_save = "save";
/* Strings related to load command */
-const char * const mi_lttng_element_load = "load";
-const char * const mi_lttng_element_load_overrides = "overrides";
-const char * const mi_lttng_element_load_override_url = "url";
+const char *const mi_lttng_element_load = "load";
+const char *const mi_lttng_element_load_overrides = "overrides";
+const char *const mi_lttng_element_load_override_url = "url";
/* General elements of mi_lttng */
-const char * const mi_lttng_element_empty = "";
-const char * const mi_lttng_element_id = "id";
-const char * const mi_lttng_element_nowrite = "nowrite";
-const char * const mi_lttng_element_success = "success";
-const char * const mi_lttng_element_type_enum = "ENUM";
-const char * const mi_lttng_element_type_float = "FLOAT";
-const char * const mi_lttng_element_type_integer = "INTEGER";
-const char * const mi_lttng_element_type_other = "OTHER";
-const char * const mi_lttng_element_type_string = "STRING";
+const char *const mi_lttng_element_empty = "";
+const char *const mi_lttng_element_id = "id";
+const char *const mi_lttng_element_nowrite = "nowrite";
+const char *const mi_lttng_element_success = "success";
+const char *const mi_lttng_element_type_enum = "ENUM";
+const char *const mi_lttng_element_type_float = "FLOAT";
+const char *const mi_lttng_element_type_integer = "INTEGER";
+const char *const mi_lttng_element_type_other = "OTHER";
+const char *const mi_lttng_element_type_string = "STRING";
/* String related to loglevel */
-const char * const mi_lttng_loglevel_str_alert = "TRACE_ALERT";
-const char * const mi_lttng_loglevel_str_crit = "TRACE_CRIT";
-const char * const mi_lttng_loglevel_str_debug = "TRACE_DEBUG";
-const char * const mi_lttng_loglevel_str_debug_function = "TRACE_DEBUG_FUNCTION";
-const char * const mi_lttng_loglevel_str_debug_line = "TRACE_DEBUG_LINE";
-const char * const mi_lttng_loglevel_str_debug_module = "TRACE_DEBUG_MODULE";
-const char * const mi_lttng_loglevel_str_debug_process = "TRACE_DEBUG_PROCESS";
-const char * const mi_lttng_loglevel_str_debug_program = "TRACE_DEBUG_PROGRAM";
-const char * const mi_lttng_loglevel_str_debug_system = "TRACE_DEBUG_SYSTEM";
-const char * const mi_lttng_loglevel_str_debug_unit = "TRACE_DEBUG_UNIT";
-const char * const mi_lttng_loglevel_str_emerg = "TRACE_EMERG";
-const char * const mi_lttng_loglevel_str_err = "TRACE_ERR";
-const char * const mi_lttng_loglevel_str_info = "TRACE_INFO";
-const char * const mi_lttng_loglevel_str_notice = "TRACE_NOTICE";
-const char * const mi_lttng_loglevel_str_unknown = "UNKNOWN";
-const char * const mi_lttng_loglevel_str_warning = "TRACE_WARNING";
+const char *const mi_lttng_loglevel_str_alert = "TRACE_ALERT";
+const char *const mi_lttng_loglevel_str_crit = "TRACE_CRIT";
+const char *const mi_lttng_loglevel_str_debug = "TRACE_DEBUG";
+const char *const mi_lttng_loglevel_str_debug_function = "TRACE_DEBUG_FUNCTION";
+const char *const mi_lttng_loglevel_str_debug_line = "TRACE_DEBUG_LINE";
+const char *const mi_lttng_loglevel_str_debug_module = "TRACE_DEBUG_MODULE";
+const char *const mi_lttng_loglevel_str_debug_process = "TRACE_DEBUG_PROCESS";
+const char *const mi_lttng_loglevel_str_debug_program = "TRACE_DEBUG_PROGRAM";
+const char *const mi_lttng_loglevel_str_debug_system = "TRACE_DEBUG_SYSTEM";
+const char *const mi_lttng_loglevel_str_debug_unit = "TRACE_DEBUG_UNIT";
+const char *const mi_lttng_loglevel_str_emerg = "TRACE_EMERG";
+const char *const mi_lttng_loglevel_str_err = "TRACE_ERR";
+const char *const mi_lttng_loglevel_str_info = "TRACE_INFO";
+const char *const mi_lttng_loglevel_str_notice = "TRACE_NOTICE";
+const char *const mi_lttng_loglevel_str_unknown = "UNKNOWN";
+const char *const mi_lttng_loglevel_str_warning = "TRACE_WARNING";
/* String related to loglevel JUL */
-const char * const mi_lttng_loglevel_str_jul_all = "JUL_ALL";
-const char * const mi_lttng_loglevel_str_jul_config = "JUL_CONFIG";
-const char * const mi_lttng_loglevel_str_jul_fine = "JUL_FINE";
-const char * const mi_lttng_loglevel_str_jul_finer = "JUL_FINER";
-const char * const mi_lttng_loglevel_str_jul_finest = "JUL_FINEST";
-const char * const mi_lttng_loglevel_str_jul_info = "JUL_INFO";
-const char * const mi_lttng_loglevel_str_jul_off = "JUL_OFF";
-const char * const mi_lttng_loglevel_str_jul_severe = "JUL_SEVERE";
-const char * const mi_lttng_loglevel_str_jul_warning = "JUL_WARNING";
+const char *const mi_lttng_loglevel_str_jul_all = "JUL_ALL";
+const char *const mi_lttng_loglevel_str_jul_config = "JUL_CONFIG";
+const char *const mi_lttng_loglevel_str_jul_fine = "JUL_FINE";
+const char *const mi_lttng_loglevel_str_jul_finer = "JUL_FINER";
+const char *const mi_lttng_loglevel_str_jul_finest = "JUL_FINEST";
+const char *const mi_lttng_loglevel_str_jul_info = "JUL_INFO";
+const char *const mi_lttng_loglevel_str_jul_off = "JUL_OFF";
+const char *const mi_lttng_loglevel_str_jul_severe = "JUL_SEVERE";
+const char *const mi_lttng_loglevel_str_jul_warning = "JUL_WARNING";
/* String related to loglevel LOG4J */
-const char * const mi_lttng_loglevel_str_log4j_off = "LOG4J_OFF";
-const char * const mi_lttng_loglevel_str_log4j_fatal = "LOG4J_FATAL";
-const char * const mi_lttng_loglevel_str_log4j_error = "LOG4J_ERROR";
-const char * const mi_lttng_loglevel_str_log4j_warn = "LOG4J_WARN";
-const char * const mi_lttng_loglevel_str_log4j_info = "LOG4J_INFO";
-const char * const mi_lttng_loglevel_str_log4j_debug = "LOG4J_DEBUG";
-const char * const mi_lttng_loglevel_str_log4j_trace = "LOG4J_TRACE";
-const char * const mi_lttng_loglevel_str_log4j_all = "LOG4J_ALL";
+const char *const mi_lttng_loglevel_str_log4j_off = "LOG4J_OFF";
+const char *const mi_lttng_loglevel_str_log4j_fatal = "LOG4J_FATAL";
+const char *const mi_lttng_loglevel_str_log4j_error = "LOG4J_ERROR";
+const char *const mi_lttng_loglevel_str_log4j_warn = "LOG4J_WARN";
+const char *const mi_lttng_loglevel_str_log4j_info = "LOG4J_INFO";
+const char *const mi_lttng_loglevel_str_log4j_debug = "LOG4J_DEBUG";
+const char *const mi_lttng_loglevel_str_log4j_trace = "LOG4J_TRACE";
+const char *const mi_lttng_loglevel_str_log4j_all = "LOG4J_ALL";
/* String related to loglevel Python */
-const char * const mi_lttng_loglevel_str_python_critical = "PYTHON_CRITICAL";
-const char * const mi_lttng_loglevel_str_python_error = "PYTHON_ERROR";
-const char * const mi_lttng_loglevel_str_python_warning = "PYTHON_WARNING";
-const char * const mi_lttng_loglevel_str_python_info = "PYTHON_INFO";
-const char * const mi_lttng_loglevel_str_python_debug = "PYTHON_DEBUG";
-const char * const mi_lttng_loglevel_str_python_notset = "PYTHON_NOTSET";
+const char *const mi_lttng_loglevel_str_python_critical = "PYTHON_CRITICAL";
+const char *const mi_lttng_loglevel_str_python_error = "PYTHON_ERROR";
+const char *const mi_lttng_loglevel_str_python_warning = "PYTHON_WARNING";
+const char *const mi_lttng_loglevel_str_python_info = "PYTHON_INFO";
+const char *const mi_lttng_loglevel_str_python_debug = "PYTHON_DEBUG";
+const char *const mi_lttng_loglevel_str_python_notset = "PYTHON_NOTSET";
/* String related to loglevel type */
-const char * const mi_lttng_loglevel_type_all = "ALL";
-const char * const mi_lttng_loglevel_type_range = "RANGE";
-const char * const mi_lttng_loglevel_type_single = "SINGLE";
-const char * const mi_lttng_loglevel_type_unknown = "UNKNOWN";
+const char *const mi_lttng_loglevel_type_all = "ALL";
+const char *const mi_lttng_loglevel_type_range = "RANGE";
+const char *const mi_lttng_loglevel_type_single = "SINGLE";
+const char *const mi_lttng_loglevel_type_unknown = "UNKNOWN";
/* String related to a lttng_snapshot_output */
-const char * const mi_lttng_element_snapshot_ctrl_url = "ctrl_url";
-const char * const mi_lttng_element_snapshot_data_url = "data_url";
-const char * const mi_lttng_element_snapshot_max_size = "max_size";
-const char * const mi_lttng_element_snapshot_n_ptr = "n_ptr";
-const char * const mi_lttng_element_snapshot_session_name = "session_name";
-const char * const mi_lttng_element_snapshots = "snapshots";
+const char *const mi_lttng_element_snapshot_ctrl_url = "ctrl_url";
+const char *const mi_lttng_element_snapshot_data_url = "data_url";
+const char *const mi_lttng_element_snapshot_max_size = "max_size";
+const char *const mi_lttng_element_snapshot_n_ptr = "n_ptr";
+const char *const mi_lttng_element_snapshot_session_name = "session_name";
+const char *const mi_lttng_element_snapshots = "snapshots";
/* String related to track/untrack command */
-const char * const mi_lttng_element_track_untrack_all_wildcard = "*";
+const char *const mi_lttng_element_track_untrack_all_wildcard = "*";
-const char * const mi_lttng_element_session_name = "session_name";
+const char *const mi_lttng_element_session_name = "session_name";
/* String related to rotate command */
-const char * const mi_lttng_element_rotation = "rotation";
-const char * const mi_lttng_element_rotate_status = "status";
-const char * const mi_lttng_element_rotation_schedule = "rotation_schedule";
-const char * const mi_lttng_element_rotation_schedules = "rotation_schedules";
-const char * const mi_lttng_element_rotation_schedule_result = "rotation_schedule_result";
-const char * const mi_lttng_element_rotation_schedule_results = "rotation_schedule_results";
-const char * const mi_lttng_element_rotation_schedule_periodic = "periodic";
-const char * const mi_lttng_element_rotation_schedule_periodic_time_us = "time_us";
-const char * const mi_lttng_element_rotation_schedule_size_threshold = "size_threshold";
-const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes = "bytes";
-const char * const mi_lttng_element_rotation_state = "state";
-const char * const mi_lttng_element_rotation_location = "location";
-const char * const mi_lttng_element_rotation_location_local = "local";
-const char * const mi_lttng_element_rotation_location_local_absolute_path = "absolute_path";
-const char * const mi_lttng_element_rotation_location_relay = "relay";
-const char * const mi_lttng_element_rotation_location_relay_host = "host";
-const char * const mi_lttng_element_rotation_location_relay_control_port = "control_port";
-const char * const mi_lttng_element_rotation_location_relay_data_port = "data_port";
-const char * const mi_lttng_element_rotation_location_relay_protocol = "protocol";
-const char * const mi_lttng_element_rotation_location_relay_relative_path = "relative_path";
+const char *const mi_lttng_element_rotation = "rotation";
+const char *const mi_lttng_element_rotate_status = "status";
+const char *const mi_lttng_element_rotation_schedule = "rotation_schedule";
+const char *const mi_lttng_element_rotation_schedules = "rotation_schedules";
+const char *const mi_lttng_element_rotation_schedule_result = "rotation_schedule_result";
+const char *const mi_lttng_element_rotation_schedule_results = "rotation_schedule_results";
+const char *const mi_lttng_element_rotation_schedule_periodic = "periodic";
+const char *const mi_lttng_element_rotation_schedule_periodic_time_us = "time_us";
+const char *const mi_lttng_element_rotation_schedule_size_threshold = "size_threshold";
+const char *const mi_lttng_element_rotation_schedule_size_threshold_bytes = "bytes";
+const char *const mi_lttng_element_rotation_state = "state";
+const char *const mi_lttng_element_rotation_location = "location";
+const char *const mi_lttng_element_rotation_location_local = "local";
+const char *const mi_lttng_element_rotation_location_local_absolute_path = "absolute_path";
+const char *const mi_lttng_element_rotation_location_relay = "relay";
+const char *const mi_lttng_element_rotation_location_relay_host = "host";
+const char *const mi_lttng_element_rotation_location_relay_control_port = "control_port";
+const char *const mi_lttng_element_rotation_location_relay_data_port = "data_port";
+const char *const mi_lttng_element_rotation_location_relay_protocol = "protocol";
+const char *const mi_lttng_element_rotation_location_relay_relative_path = "relative_path";
/* String related to enum lttng_rotation_state */
-const char * const mi_lttng_rotation_state_str_ongoing = "ONGOING";
-const char * const mi_lttng_rotation_state_str_completed = "COMPLETED";
-const char * const mi_lttng_rotation_state_str_expired = "EXPIRED";
-const char * const mi_lttng_rotation_state_str_error = "ERROR";
+const char *const mi_lttng_rotation_state_str_ongoing = "ONGOING";
+const char *const mi_lttng_rotation_state_str_completed = "COMPLETED";
+const char *const mi_lttng_rotation_state_str_expired = "EXPIRED";
+const char *const mi_lttng_rotation_state_str_error = "ERROR";
/* String related to enum lttng_trace_archive_location_relay_protocol_type */
-const char * const mi_lttng_rotation_location_relay_protocol_str_tcp = "TCP";
+const char *const mi_lttng_rotation_location_relay_protocol_str_tcp = "TCP";
/* String related to rate_policy elements */
const char *const mi_lttng_element_rate_policy = "rate_policy";
-const char *const mi_lttng_element_rate_policy_every_n =
- "rate_policy_every_n";
-const char *const mi_lttng_element_rate_policy_once_after_n =
- "rate_policy_once_after_n";
+const char *const mi_lttng_element_rate_policy_every_n = "rate_policy_every_n";
+const char *const mi_lttng_element_rate_policy_once_after_n = "rate_policy_once_after_n";
-const char *const mi_lttng_element_rate_policy_every_n_interval =
- "interval";
-const char
- *const mi_lttng_element_rate_policy_once_after_n_threshold =
- "threshold";
+const char *const mi_lttng_element_rate_policy_every_n_interval = "interval";
+const char *const mi_lttng_element_rate_policy_once_after_n_threshold = "threshold";
/* String related to action elements */
const char *const mi_lttng_element_action = "action";
const char *const mi_lttng_element_action_list = "action_list";
const char *const mi_lttng_element_action_notify = "action_notify";
-const char *const mi_lttng_element_action_start_session =
- "action_start_session";
-const char *const mi_lttng_element_action_stop_session =
- "action_stop_session";
-const char *const mi_lttng_element_action_rotate_session =
- "action_rotate_session";
-const char *const mi_lttng_element_action_snapshot_session =
- "action_snapshot_session";
-const char *const mi_lttng_element_action_snapshot_session_output =
- "output";
+const char *const mi_lttng_element_action_start_session = "action_start_session";
+const char *const mi_lttng_element_action_stop_session = "action_stop_session";
+const char *const mi_lttng_element_action_rotate_session = "action_rotate_session";
+const char *const mi_lttng_element_action_snapshot_session = "action_snapshot_session";
+const char *const mi_lttng_element_action_snapshot_session_output = "output";
/* String related to condition */
const char *const mi_lttng_element_condition = "condition";
-const char *const mi_lttng_element_condition_buffer_usage_high =
- "condition_buffer_usage_high";
-const char *const mi_lttng_element_condition_buffer_usage_low =
- "condition_buffer_usage_low";
-const char *const mi_lttng_element_condition_event_rule_matches =
- "condition_event_rule_matches";
+const char *const mi_lttng_element_condition_buffer_usage_high = "condition_buffer_usage_high";
+const char *const mi_lttng_element_condition_buffer_usage_low = "condition_buffer_usage_low";
+const char *const mi_lttng_element_condition_event_rule_matches = "condition_event_rule_matches";
const char *const mi_lttng_element_condition_session_consumed_size =
- "condition_session_consumed_size";
-const char *const mi_lttng_element_condition_session_rotation =
- "condition_session_rotation";
-const char
- *const mi_lttng_element_condition_session_rotation_completed =
- "condition_session_rotation_completed";
-const char
- *const mi_lttng_element_condition_session_rotation_ongoing =
- "condition_session_rotation_ongoing";
-
-const char *const mi_lttng_element_condition_channel_name =
- "channel_name";
-const char *const mi_lttng_element_condition_threshold_bytes =
- "threshold_bytes";
-const char *const mi_lttng_element_condition_threshold_ratio =
- "threshold_ratio";
+ "condition_session_consumed_size";
+const char *const mi_lttng_element_condition_session_rotation = "condition_session_rotation";
+const char *const mi_lttng_element_condition_session_rotation_completed =
+ "condition_session_rotation_completed";
+const char *const mi_lttng_element_condition_session_rotation_ongoing =
+ "condition_session_rotation_ongoing";
+
+const char *const mi_lttng_element_condition_channel_name = "channel_name";
+const char *const mi_lttng_element_condition_threshold_bytes = "threshold_bytes";
+const char *const mi_lttng_element_condition_threshold_ratio = "threshold_ratio";
/* String related to capture descriptor */
-const char *const mi_lttng_element_capture_descriptor =
- "capture_descriptor";
-const char *const mi_lttng_element_capture_descriptors =
- "capture_descriptors";
+const char *const mi_lttng_element_capture_descriptor = "capture_descriptor";
+const char *const mi_lttng_element_capture_descriptors = "capture_descriptors";
/* String related to event expression */
const char *const mi_lttng_element_event_expr = "event_expr";
-const char *const mi_lttng_element_event_expr_payload_field =
- "event_expr_payload_field";
+const char *const mi_lttng_element_event_expr_payload_field = "event_expr_payload_field";
const char *const mi_lttng_element_event_expr_channel_context_field =
- "event_expr_channel_context_field";
-const char
- *const mi_lttng_element_event_expr_app_specific_context_field =
- "event_expr_app_specific_context_field";
+ "event_expr_channel_context_field";
+const char *const mi_lttng_element_event_expr_app_specific_context_field =
+ "event_expr_app_specific_context_field";
const char *const mi_lttng_element_event_expr_array_field_element =
- "event_expr_array_field_element";
-const char *const mi_lttng_element_event_expr_provider_name =
- "provider_name";
-const char *const mi_lttng_element_event_expr_type_name =
- "type_name";
+ "event_expr_array_field_element";
+const char *const mi_lttng_element_event_expr_provider_name = "provider_name";
+const char *const mi_lttng_element_event_expr_type_name = "type_name";
const char *const mi_lttng_element_event_expr_index = "index";
/* String related to event rule */
const char *const mi_lttng_element_event_rule = "event_rule";
/* String related to lttng_event_rule_type */
-const char *const mi_lttng_element_event_rule_event_name =
- "event_name";
-const char *const mi_lttng_element_event_rule_name_pattern =
- "name_pattern";
-const char *const mi_lttng_element_event_rule_filter_expression =
- "filter_expression";
-
-const char *const mi_lttng_element_event_rule_jul_logging =
- "event_rule_jul_logging";
-const char *const mi_lttng_element_event_rule_kernel_kprobe =
- "event_rule_kernel_kprobe";
-const char *const mi_lttng_element_event_rule_kernel_syscall =
- "event_rule_kernel_syscall";
-const char *const mi_lttng_element_event_rule_kernel_tracepoint =
- "event_rule_kernel_tracepoint";
-const char *const mi_lttng_element_event_rule_kernel_uprobe =
- "event_rule_kernel_uprobe";
-const char *const mi_lttng_element_event_rule_log4j_logging =
- "event_rule_log4j_logging";
-const char *const mi_lttng_element_event_rule_python_logging =
- "event_rule_python_logging";
-const char *const mi_lttng_element_event_rule_user_tracepoint =
- "event_rule_user_tracepoint";
+const char *const mi_lttng_element_event_rule_event_name = "event_name";
+const char *const mi_lttng_element_event_rule_name_pattern = "name_pattern";
+const char *const mi_lttng_element_event_rule_filter_expression = "filter_expression";
+
+const char *const mi_lttng_element_event_rule_jul_logging = "event_rule_jul_logging";
+const char *const mi_lttng_element_event_rule_kernel_kprobe = "event_rule_kernel_kprobe";
+const char *const mi_lttng_element_event_rule_kernel_syscall = "event_rule_kernel_syscall";
+const char *const mi_lttng_element_event_rule_kernel_tracepoint = "event_rule_kernel_tracepoint";
+const char *const mi_lttng_element_event_rule_kernel_uprobe = "event_rule_kernel_uprobe";
+const char *const mi_lttng_element_event_rule_log4j_logging = "event_rule_log4j_logging";
+const char *const mi_lttng_element_event_rule_python_logging = "event_rule_python_logging";
+const char *const mi_lttng_element_event_rule_user_tracepoint = "event_rule_user_tracepoint";
/* String related to lttng_event_rule_kernel_syscall. */
-const char *const
- mi_lttng_element_event_rule_kernel_syscall_emission_site =
- "emission_site";
+const char *const mi_lttng_element_event_rule_kernel_syscall_emission_site = "emission_site";
/* String related to enum lttng_event_rule_kernel_syscall_emission_site. */
-const char *const
- mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit =
- "entry+exit";
-const char
- *const mi_lttng_event_rule_kernel_syscall_emission_site_entry =
- "entry";
-const char *const
- mi_lttng_event_rule_kernel_syscall_emission_site_exit = "exit";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry_exit = "entry+exit";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_entry = "entry";
+const char *const mi_lttng_event_rule_kernel_syscall_emission_site_exit = "exit";
/* String related to lttng_event_rule_user_tracepoint */
-const char *const
- mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions =
- "name_pattern_exclusions";
-const char *const
- mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion =
- "name_pattern_exclusion";
+const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusions =
+ "name_pattern_exclusions";
+const char *const mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion =
+ "name_pattern_exclusion";
/* String related to log level rule. */
-const char *const mi_lttng_element_log_level_rule =
- "log_level_rule";
-const char *const mi_lttng_element_log_level_rule_exactly =
- "log_level_rule_exactly";
-const char
- *const mi_lttng_element_log_level_rule_at_least_as_severe_as =
- "log_level_rule_at_least_as_severe_as";
+const char *const mi_lttng_element_log_level_rule = "log_level_rule";
+const char *const mi_lttng_element_log_level_rule_exactly = "log_level_rule_exactly";
+const char *const mi_lttng_element_log_level_rule_at_least_as_severe_as =
+ "log_level_rule_at_least_as_severe_as";
const char *const mi_lttng_element_log_level_rule_level = "level";
/* String related to kernel probe location. */
-const char *const mi_lttng_element_kernel_probe_location =
- "kernel_probe_location";
-const char
- *const mi_lttng_element_kernel_probe_location_symbol_offset =
- "kernel_probe_location_symbol_offset";
-const char *const
- mi_lttng_element_kernel_probe_location_symbol_offset_name =
- "name";
-const char *const
- mi_lttng_element_kernel_probe_location_symbol_offset_offset =
- "offset";
-
-const char *const mi_lttng_element_kernel_probe_location_address =
- "kernel_probe_location_address";
-const char
- *const mi_lttng_element_kernel_probe_location_address_address =
- "address";
+const char *const mi_lttng_element_kernel_probe_location = "kernel_probe_location";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset =
+ "kernel_probe_location_symbol_offset";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset_name = "name";
+const char *const mi_lttng_element_kernel_probe_location_symbol_offset_offset = "offset";
+
+const char *const mi_lttng_element_kernel_probe_location_address = "kernel_probe_location_address";
+const char *const mi_lttng_element_kernel_probe_location_address_address = "address";
/* String related to userspace probe location. */
-const char *const mi_lttng_element_userspace_probe_location =
- "userspace_probe_location";
-const char
- *const mi_lttng_element_userspace_probe_location_binary_path =
- "binary_path";
-const char
- *const mi_lttng_element_userspace_probe_location_function =
- "userspace_probe_location_function";
-const char
- *const mi_lttng_element_userspace_probe_location_function_name =
- "name";
-const char
- *const mi_lttng_element_userspace_probe_location_lookup_method =
- "userspace_probe_location_lookup_method";
-const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_function_default =
- "userspace_probe_location_lookup_method_function_default";
-const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_function_elf =
- "userspace_probe_location_lookup_method_function_elf";
-const char *const
- mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt =
- "userspace_probe_location_lookup_method_tracepoint_sdt";
-const char
- *const mi_lttng_element_userspace_probe_location_tracepoint =
- "userspace_probe_location_tracepoint";
-const char *const
- mi_lttng_element_userspace_probe_location_tracepoint_probe_name =
- "probe_name";
-const char *const
- mi_lttng_element_userspace_probe_location_tracepoint_provider_name =
- "provider_name";
+const char *const mi_lttng_element_userspace_probe_location = "userspace_probe_location";
+const char *const mi_lttng_element_userspace_probe_location_binary_path = "binary_path";
+const char *const mi_lttng_element_userspace_probe_location_function =
+ "userspace_probe_location_function";
+const char *const mi_lttng_element_userspace_probe_location_function_name = "name";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method =
+ "userspace_probe_location_lookup_method";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_default =
+ "userspace_probe_location_lookup_method_function_default";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_function_elf =
+ "userspace_probe_location_lookup_method_function_elf";
+const char *const mi_lttng_element_userspace_probe_location_lookup_method_tracepoint_sdt =
+ "userspace_probe_location_lookup_method_tracepoint_sdt";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint =
+ "userspace_probe_location_tracepoint";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint_probe_name = "probe_name";
+const char *const mi_lttng_element_userspace_probe_location_tracepoint_provider_name =
+ "provider_name";
/* String related to enum
* lttng_userspace_probe_location_function_instrumentation_type */
-const char *const
- mi_lttng_element_userspace_probe_location_function_instrumentation_type =
- "instrumentation_type";
-const char *const
- mi_lttng_userspace_probe_location_function_instrumentation_type_entry =
- "ENTRY";
+const char *const mi_lttng_element_userspace_probe_location_function_instrumentation_type =
+ "instrumentation_type";
+const char *const mi_lttng_userspace_probe_location_function_instrumentation_type_entry = "ENTRY";
/* String related to trigger */
const char *const mi_lttng_element_triggers = "triggers";
const char *const mi_lttng_element_trigger_owner_uid = "owner_uid";
/* String related to error_query. */
-const char *const mi_lttng_element_error_query_result =
- "error_query_result";
-const char *const mi_lttng_element_error_query_result_counter =
- "error_query_result_counter";
-const char *const
- mi_lttng_element_error_query_result_counter_value = "value";
-const char *const mi_lttng_element_error_query_result_description =
- "description";
-const char *const mi_lttng_element_error_query_result_name =
- "name";
-const char *const mi_lttng_element_error_query_result_type =
- "type";
-const char *const mi_lttng_element_error_query_results =
- "error_query_results";
+const char *const mi_lttng_element_error_query_result = "error_query_result";
+const char *const mi_lttng_element_error_query_result_counter = "error_query_result_counter";
+const char *const mi_lttng_element_error_query_result_counter_value = "value";
+const char *const mi_lttng_element_error_query_result_description = "description";
+const char *const mi_lttng_element_error_query_result_name = "name";
+const char *const mi_lttng_element_error_query_result_type = "type";
+const char *const mi_lttng_element_error_query_results = "error_query_results";
/* String related to add-context command */
-const char * const mi_lttng_element_context_symbol = "symbol";
+const char *const mi_lttng_element_context_symbol = "symbol";
/* Deprecated symbols preserved for ABI compatibility. */
LTTNG_EXPORT const char *mi_lttng_context_type_perf_counter;
}
}
-static
-const char *mi_lttng_eventtype_string(enum lttng_event_type value)
+static const char *mi_lttng_eventtype_string(enum lttng_event_type value)
{
switch (value) {
case LTTNG_EVENT_ALL:
}
}
-static
-const char *mi_lttng_event_contexttype_string(enum lttng_event_context_type val)
+static const char *mi_lttng_event_contexttype_string(enum lttng_event_context_type val)
{
switch (val) {
case LTTNG_EVENT_CONTEXT_PID:
case LTTNG_EVENT_CONTEXT_VSGID:
return config_event_context_vsgid;
default:
- return NULL;
+ return nullptr;
}
}
const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type val)
{
switch (val) {
- case(LTTNG_EVENT_FIELD_INTEGER):
+ case (LTTNG_EVENT_FIELD_INTEGER):
return mi_lttng_element_type_integer;
- case(LTTNG_EVENT_FIELD_ENUM):
+ case (LTTNG_EVENT_FIELD_ENUM):
return mi_lttng_element_type_enum;
- case(LTTNG_EVENT_FIELD_FLOAT):
+ case (LTTNG_EVENT_FIELD_FLOAT):
return mi_lttng_element_type_float;
- case(LTTNG_EVENT_FIELD_STRING):
+ case (LTTNG_EVENT_FIELD_STRING):
return mi_lttng_element_type_string;
default:
return mi_lttng_element_type_other;
default:
/* Should not have an unknown domain */
abort();
- return NULL;
+ return nullptr;
}
}
default:
/* Should not have an unknow buffer type */
abort();
- return NULL;
+ return nullptr;
}
}
default:
/* Should not have an unknow rotation state. */
abort();
- return NULL;
+ return nullptr;
}
}
const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
- enum lttng_trace_archive_location_relay_protocol_type value)
+ enum lttng_trace_archive_location_relay_protocol_type value)
{
switch (value) {
case LTTNG_TRACE_ARCHIVE_LOCATION_RELAY_PROTOCOL_TYPE_TCP:
default:
/* Should not have an unknown relay protocol. */
abort();
- return NULL;
+ return nullptr;
}
}
{
struct mi_writer *mi_writer;
- mi_writer = (struct mi_writer *) zmalloc(sizeof(struct mi_writer));
+ mi_writer = zmalloc<struct mi_writer>();
if (!mi_writer) {
PERROR("zmalloc mi_writer_create");
goto end;
err_destroy:
free(mi_writer);
- return NULL;
+ return nullptr;
}
int mi_lttng_writer_destroy(struct mi_writer *writer)
* A command is always the MI's root node, it must declare the current
* namespace and schema URIs and the schema's version.
*/
- ret = config_writer_open_element(writer->writer,
- mi_lttng_element_command);
+ ret = config_writer_open_element(writer->writer, mi_lttng_element_command);
if (ret) {
goto end;
}
- ret = config_writer_write_attribute(writer->writer,
- mi_lttng_xmlns, DEFAULT_LTTNG_MI_NAMESPACE);
+ ret = config_writer_write_attribute(
+ writer->writer, mi_lttng_xmlns, DEFAULT_LTTNG_MI_NAMESPACE);
if (ret) {
goto end;
}
- ret = config_writer_write_attribute(writer->writer,
- mi_lttng_xmlns_xsi, mi_lttng_w3_schema_uri);
+ ret = config_writer_write_attribute(
+ writer->writer, mi_lttng_xmlns_xsi, mi_lttng_w3_schema_uri);
if (ret) {
goto end;
}
- ret = config_writer_write_attribute(writer->writer,
- mi_lttng_schema_location,
- mi_lttng_schema_location_uri);
+ ret = config_writer_write_attribute(
+ writer->writer, mi_lttng_schema_location, mi_lttng_schema_location_uri);
if (ret) {
goto end;
}
- ret = config_writer_write_attribute(writer->writer,
- mi_lttng_schema_version,
- mi_lttng_schema_version_value);
+ ret = config_writer_write_attribute(
+ writer->writer, mi_lttng_schema_version, mi_lttng_schema_version_value);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_command_name, command);
+ ret = mi_lttng_writer_write_element_string(writer, mi_lttng_element_command_name, command);
end:
return ret;
}
return mi_lttng_writer_close_element(writer);
}
-int mi_lttng_writer_open_element(struct mi_writer *writer,
- const char *element_name)
+int mi_lttng_writer_open_element(struct mi_writer *writer, const char *element_name)
{
return config_writer_open_element(writer->writer, element_name);
}
return config_writer_close_element(writer->writer);
}
-int mi_lttng_close_multi_element(struct mi_writer *writer,
- unsigned int nb_element)
+int mi_lttng_close_multi_element(struct mi_writer *writer, unsigned int nb_element)
{
int ret, i;
}
int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
- const char *element_name, uint64_t value)
+ const char *element_name,
+ uint64_t value)
{
- return config_writer_write_element_unsigned_int(writer->writer,
- element_name, value);
+ return config_writer_write_element_unsigned_int(writer->writer, element_name, value);
}
int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
- const char *element_name, int64_t value)
+ const char *element_name,
+ int64_t value)
{
- return config_writer_write_element_signed_int(writer->writer,
- element_name, value);
+ return config_writer_write_element_signed_int(writer->writer, element_name, value);
}
int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
- const char *element_name, int value)
+ const char *element_name,
+ int value)
{
- return config_writer_write_element_bool(writer->writer,
- element_name, value);
+ return config_writer_write_element_bool(writer->writer, element_name, value);
}
int mi_lttng_writer_write_element_string(struct mi_writer *writer,
- const char *element_name, const char *value)
+ const char *element_name,
+ const char *value)
{
- return config_writer_write_element_string(writer->writer,
- element_name, value);
+ return config_writer_write_element_string(writer->writer, element_name, value);
}
int mi_lttng_writer_write_element_double(struct mi_writer *writer,
- const char *element_name,
- double value)
+ const char *element_name,
+ double value)
{
- return config_writer_write_element_double(
- writer->writer, element_name, value);
+ return config_writer_write_element_double(writer->writer, element_name, value);
}
-int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version_data *version,
- const char *lttng_description, const char *lttng_license)
+int mi_lttng_version(struct mi_writer *writer,
+ struct mi_lttng_version_data *version,
+ const char *lttng_description,
+ const char *lttng_license)
{
int ret;
}
/* Version string (contain info like rc etc.) */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_str, version->version);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_version_str, version->version);
if (ret) {
goto end;
}
/* Major version number */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_version_major, version->version_major);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_version_major, version->version_major);
if (ret) {
goto end;
}
/* Minor version number */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_version_minor, version->version_minor);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_version_minor, version->version_minor);
if (ret) {
goto end;
}
/* Commit version number */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_commit, version->version_commit);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_version_commit, version->version_commit);
if (ret) {
goto end;
}
/* Patch number */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_version_patch_level, version->version_patchlevel);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_version_patch_level, version->version_patchlevel);
if (ret) {
goto end;
}
/* Name of the version */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_name, version->version_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_name, version->version_name);
if (ret) {
goto end;
}
/* Description mostly related to beer... */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_description, lttng_description);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_version_description, lttng_description);
if (ret) {
goto end;
}
/* url */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_web, version->package_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_version_web, version->package_url);
if (ret) {
goto end;
}
/* License: free as in free beer...no...*speech* */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_license, lttng_license);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_version_license, lttng_license);
if (ret) {
goto end;
}
return mi_lttng_writer_open_element(writer, config_element_sessions);
}
-int mi_lttng_session(struct mi_writer *writer,
- struct lttng_session *session, int is_open)
+int mi_lttng_session(struct mi_writer *writer, const struct lttng_session *session, int is_open)
{
int ret;
LTTNG_ASSERT(session);
/* Open sessions element */
- ret = mi_lttng_writer_open_element(writer,
- config_element_session);
+ ret = mi_lttng_writer_open_element(writer, config_element_session);
if (ret) {
goto end;
}
/* Name of the session */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_name, session->name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, session->name);
if (ret) {
goto end;
}
/* Path */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_path, session->path);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_path, session->path);
if (ret) {
goto end;
}
/* Enabled ? */
- ret = mi_lttng_writer_write_element_bool(writer,
- config_element_enabled, session->enabled);
+ ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, session->enabled);
if (ret) {
goto end;
}
/* Snapshot mode */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_snapshot_mode, session->snapshot_mode);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_snapshot_mode, session->snapshot_mode);
if (ret) {
goto end;
}
/* Live timer interval in usec */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_live_timer_interval,
- session->live_timer_interval);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_live_timer_interval, session->live_timer_interval);
if (ret) {
goto end;
}
}
end:
return ret;
-
}
int mi_lttng_domains_open(struct mi_writer *writer)
return mi_lttng_writer_open_element(writer, config_element_domains);
}
-int mi_lttng_domain(struct mi_writer *writer,
- struct lttng_domain *domain, int is_open)
+int mi_lttng_domain(struct mi_writer *writer, struct lttng_domain *domain, int is_open)
{
int ret = 0;
const char *str_domain;
/* Domain Type */
str_domain = mi_lttng_domaintype_string(domain->type);
- ret = mi_lttng_writer_write_element_string(writer, config_element_type,
- str_domain);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_type, str_domain);
if (ret) {
goto end;
}
/* Buffer Type */
- str_buffer= mi_lttng_buffertype_string(domain->buf_type);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_buffer_type, str_buffer);
+ str_buffer = mi_lttng_buffertype_string(domain->buf_type);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_buffer_type, str_buffer);
if (ret) {
goto end;
}
end:
return ret;
-
}
int mi_lttng_channels_open(struct mi_writer *writer)
return mi_lttng_writer_open_element(writer, config_element_channels);
}
-int mi_lttng_channel(struct mi_writer *writer,
- struct lttng_channel *channel, int is_open)
+int mi_lttng_channel(struct mi_writer *writer, struct lttng_channel *channel, int is_open)
{
int ret = 0;
}
/* Name */
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- channel->name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, channel->name);
if (ret) {
goto end;
}
/* Enabled ? */
- ret = mi_lttng_writer_write_element_bool(writer,
- config_element_enabled, channel->enabled);
+ ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, channel->enabled);
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_channel_attr(struct mi_writer *writer,
- struct lttng_channel_attr *attr)
+int mi_lttng_channel_attr(struct mi_writer *writer, struct lttng_channel_attr *attr)
{
int ret = 0;
- struct lttng_channel *chan = caa_container_of(attr,
- struct lttng_channel, attr);
+ struct lttng_channel *chan = caa_container_of(attr, struct lttng_channel, attr);
uint64_t discarded_events, lost_packets, monitor_timer_interval;
int64_t blocking_timeout;
goto end;
}
- ret = lttng_channel_get_monitor_timer_interval(chan,
- &monitor_timer_interval);
+ ret = lttng_channel_get_monitor_timer_interval(chan, &monitor_timer_interval);
if (ret) {
goto end;
}
- ret = lttng_channel_get_blocking_timeout(chan,
- &blocking_timeout);
+ ret = lttng_channel_get_blocking_timeout(chan, &blocking_timeout);
if (ret) {
goto end;
}
}
/* Overwrite */
- ret = mi_lttng_writer_write_element_string(writer,
+ ret = mi_lttng_writer_write_element_string(
+ writer,
config_element_overwrite_mode,
- attr->overwrite ? config_overwrite_mode_overwrite :
- config_overwrite_mode_discard);
+ attr->overwrite ? config_overwrite_mode_overwrite : config_overwrite_mode_discard);
if (ret) {
goto end;
}
/* Sub buffer size in byte */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_subbuf_size, attr->subbuf_size);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_subbuf_size, attr->subbuf_size);
if (ret) {
goto end;
}
/* Number of subbuffer (power of two) */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_num_subbuf,
- attr->num_subbuf);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_num_subbuf, attr->num_subbuf);
if (ret) {
goto end;
}
/* Switch timer interval in usec */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_switch_timer_interval,
- attr->switch_timer_interval);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_switch_timer_interval, attr->switch_timer_interval);
if (ret) {
goto end;
}
/* Read timer interval in usec */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_read_timer_interval,
- attr->read_timer_interval);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_read_timer_interval, attr->read_timer_interval);
if (ret) {
goto end;
}
/* Monitor timer interval in usec */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_monitor_timer_interval,
- monitor_timer_interval);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_monitor_timer_interval, monitor_timer_interval);
if (ret) {
goto end;
}
/* Retry timeout in usec */
- ret = mi_lttng_writer_write_element_signed_int(writer,
- config_element_blocking_timeout,
- blocking_timeout);
+ ret = mi_lttng_writer_write_element_signed_int(
+ writer, config_element_blocking_timeout, blocking_timeout);
if (ret) {
goto end;
}
/* Event output */
ret = mi_lttng_writer_write_element_string(writer,
- config_element_output_type,
- attr->output == LTTNG_EVENT_SPLICE ?
- config_output_type_splice : config_output_type_mmap);
+ config_element_output_type,
+ attr->output == LTTNG_EVENT_SPLICE ?
+ config_output_type_splice :
+ config_output_type_mmap);
if (ret) {
goto end;
}
/* Tracefile size in bytes */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_tracefile_size, attr->tracefile_size);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_tracefile_size, attr->tracefile_size);
if (ret) {
goto end;
}
/* Count of tracefiles */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_tracefile_count,
- attr->tracefile_count);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_tracefile_count, attr->tracefile_count);
if (ret) {
goto end;
}
/* Live timer interval in usec*/
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_live_timer_interval,
- attr->live_timer_interval);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_live_timer_interval, attr->live_timer_interval);
if (ret) {
goto end;
}
/* Discarded events */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_discarded_events,
- discarded_events);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_discarded_events, discarded_events);
if (ret) {
goto end;
}
/* Lost packets */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_lost_packets,
- lost_packets);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_lost_packets, lost_packets);
if (ret) {
goto end;
}
}
end:
return ret;
-
}
-int mi_lttng_event_common_attributes(struct mi_writer *writer,
- struct lttng_event *event)
+int mi_lttng_event_common_attributes(struct mi_writer *writer, struct lttng_event *event)
{
int ret;
const char *filter_expression;
}
/* Event name */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_name, event->name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, event->name);
if (ret) {
goto end;
}
/* Event type */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_type, mi_lttng_eventtype_string(event->type));
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_type, mi_lttng_eventtype_string(event->type));
if (ret) {
goto end;
}
/* Is event enabled */
- ret = mi_lttng_writer_write_element_bool(writer,
- config_element_enabled, event->enabled);
+ ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, event->enabled);
if (ret) {
goto end;
}
}
if (filter_expression) {
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_filter_expression,
- filter_expression);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_filter_expression, filter_expression);
if (ret) {
goto end;
}
return ret;
}
-static int write_event_exclusions(struct mi_writer *writer,
- struct lttng_event *event)
+static int write_event_exclusions(struct mi_writer *writer, struct lttng_event *event)
{
int i;
int ret;
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_exclusion, name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_exclusion, name);
if (ret) {
/* Close exclusions */
mi_lttng_writer_close_element(writer);
}
int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
- struct lttng_event *event, enum lttng_domain_type domain)
+ struct lttng_event *event,
+ enum lttng_domain_type domain)
{
int ret;
/* Event loglevel */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_loglevel,
- mi_lttng_loglevel_string(event->loglevel, domain));
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_loglevel, mi_lttng_loglevel_string(event->loglevel, domain));
if (ret) {
goto end;
}
/* Log level type */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_loglevel_type,
- mi_lttng_logleveltype_string(event->loglevel_type));
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_loglevel_type,
+ mi_lttng_logleveltype_string(event->loglevel_type));
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
- struct lttng_event *event)
+int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer, struct lttng_event *event)
{
/* event exclusion filter */
return write_event_exclusions(writer, event);
}
-int mi_lttng_event_function_probe(struct mi_writer *writer,
- struct lttng_event *event)
+int mi_lttng_event_function_probe(struct mi_writer *writer, struct lttng_event *event)
{
int ret;
if (event->attr.probe.addr != 0) {
/* event probe address */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_address, event->attr.probe.addr);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_address, event->attr.probe.addr);
if (ret) {
goto end;
}
} else {
/* event probe offset */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_offset, event->attr.probe.offset);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_offset, event->attr.probe.offset);
if (ret) {
goto end;
}
/* event probe symbol_name */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_symbol_name, event->attr.probe.symbol_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_symbol_name, event->attr.probe.symbol_name);
if (ret) {
goto end;
}
return ret;
}
-static
-int mi_lttng_event_userspace_probe(struct mi_writer *writer,
- struct lttng_event *event)
+static int mi_lttng_event_userspace_probe(struct mi_writer *writer, struct lttng_event *event)
{
int ret;
const struct lttng_userspace_probe_location *location;
const char *function_name;
const char *binary_path;
- ret = mi_lttng_writer_open_element(writer,
- config_element_userspace_probe_function_attributes);
+ ret = mi_lttng_writer_open_element(
+ writer, config_element_userspace_probe_function_attributes);
if (ret) {
goto end;
}
switch (lookup_type) {
case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF:
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_lookup,
- config_element_userspace_probe_lookup_function_elf);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_lookup,
+ config_element_userspace_probe_lookup_function_elf);
if (ret) {
goto end;
}
break;
case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_lookup,
- config_element_userspace_probe_lookup_function_default);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_lookup,
+ config_element_userspace_probe_lookup_function_default);
if (ret) {
goto end;
}
}
binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_location_binary_path, binary_path);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_userspace_probe_location_binary_path, binary_path);
if (ret) {
goto end;
}
function_name = lttng_userspace_probe_location_function_get_function_name(location);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_function_location_function_name,
- function_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_function_location_function_name,
+ function_name);
if (ret) {
goto end;
}
const char *probe_name, *provider_name;
const char *binary_path;
- ret = mi_lttng_writer_open_element(writer,
- config_element_userspace_probe_function_attributes);
+ ret = mi_lttng_writer_open_element(
+ writer, config_element_userspace_probe_function_attributes);
if (ret) {
goto end;
}
switch (lookup_type) {
case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT:
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_lookup,
- config_element_userspace_probe_lookup_tracepoint_sdt);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_lookup,
+ config_element_userspace_probe_lookup_tracepoint_sdt);
if (ret) {
goto end;
}
}
binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_location_binary_path,
- binary_path);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_userspace_probe_location_binary_path, binary_path);
if (ret) {
goto end;
}
- provider_name = lttng_userspace_probe_location_tracepoint_get_provider_name(location);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_tracepoint_location_provider_name,
- provider_name);
+ provider_name =
+ lttng_userspace_probe_location_tracepoint_get_provider_name(location);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_tracepoint_location_provider_name,
+ provider_name);
if (ret) {
goto end;
}
probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_userspace_probe_tracepoint_location_probe_name, probe_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ config_element_userspace_probe_tracepoint_location_probe_name,
+ probe_name);
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_event_function_entry(struct mi_writer *writer,
- struct lttng_event *event)
+int mi_lttng_event_function_entry(struct mi_writer *writer, struct lttng_event *event)
{
int ret;
}
/* event probe symbol_name */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_symbol_name, event->attr.ftrace.symbol_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_symbol_name, event->attr.ftrace.symbol_name);
if (ret) {
goto end;
}
}
int mi_lttng_event(struct mi_writer *writer,
- struct lttng_event *event, int is_open, enum lttng_domain_type domain)
+ struct lttng_event *event,
+ int is_open,
+ enum lttng_domain_type domain)
{
int ret;
int mi_lttng_trackers_open(struct mi_writer *writer)
{
- return mi_lttng_writer_open_element(
- writer, config_element_process_attr_trackers);
+ return mi_lttng_writer_open_element(writer, config_element_process_attr_trackers);
}
static int get_tracker_elements(enum lttng_process_attr process_attr,
- const char **element_process_attr_tracker,
- const char **element_process_attr_value)
+ const char **element_process_attr_tracker,
+ const char **element_process_attr_value)
{
int ret = 0;
switch (process_attr) {
case LTTNG_PROCESS_ATTR_PROCESS_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_pid;
- *element_process_attr_value =
- config_element_process_attr_pid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_pid;
+ *element_process_attr_value = config_element_process_attr_pid_value;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_vpid;
- *element_process_attr_value =
- config_element_process_attr_vpid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_vpid;
+ *element_process_attr_value = config_element_process_attr_vpid_value;
break;
case LTTNG_PROCESS_ATTR_USER_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_uid;
- *element_process_attr_value =
- config_element_process_attr_uid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_uid;
+ *element_process_attr_value = config_element_process_attr_uid_value;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_vuid;
- *element_process_attr_value =
- config_element_process_attr_vuid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_vuid;
+ *element_process_attr_value = config_element_process_attr_vuid_value;
break;
case LTTNG_PROCESS_ATTR_GROUP_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_gid;
- *element_process_attr_value =
- config_element_process_attr_gid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_gid;
+ *element_process_attr_value = config_element_process_attr_gid_value;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
- *element_process_attr_tracker =
- config_element_process_attr_tracker_vgid;
- *element_process_attr_value =
- config_element_process_attr_vgid_value;
+ *element_process_attr_tracker = config_element_process_attr_tracker_vgid;
+ *element_process_attr_value = config_element_process_attr_vgid_value;
break;
default:
ret = LTTNG_ERR_SAVE_IO_FAIL;
return ret;
}
-int mi_lttng_process_attribute_tracker_open(
- struct mi_writer *writer, enum lttng_process_attr process_attr)
+int mi_lttng_process_attribute_tracker_open(struct mi_writer *writer,
+ enum lttng_process_attr process_attr)
{
int ret;
const char *element_tracker, *element_value;
- ret = get_tracker_elements(
- process_attr, &element_tracker, &element_value);
+ ret = get_tracker_elements(process_attr, &element_tracker, &element_value);
if (ret) {
return ret;
}
* TODO: move the listing of pid for user agent to process semantic on
* mi api bump. The use of process element break the mi api.
*/
-int mi_lttng_pid(struct mi_writer *writer,
- pid_t pid,
- const char *name,
- int is_open)
+int mi_lttng_pid(struct mi_writer *writer, pid_t pid, const char *name, int is_open)
{
int ret;
}
/* Writing pid number */
- ret = mi_lttng_writer_write_element_signed_int(writer,
- mi_lttng_element_pid_id, (int)pid);
+ ret = mi_lttng_writer_write_element_signed_int(writer, mi_lttng_element_pid_id, (int) pid);
if (ret) {
goto end;
}
/* Writing name of the process */
if (name) {
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
if (ret) {
goto end;
}
int mi_lttng_process_attr_values_open(struct mi_writer *writer)
{
- return mi_lttng_writer_open_element(
- writer, config_element_process_attr_values);
+ return mi_lttng_writer_open_element(writer, config_element_process_attr_values);
}
int mi_lttng_all_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- bool is_open)
+ enum lttng_process_attr process_attr,
+ bool is_open)
{
int ret;
const char *element_id_tracker, *element_target_id;
- ret = get_tracker_elements(
- process_attr, &element_id_tracker, &element_target_id);
+ ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
if (ret) {
return ret;
}
}
int mi_lttng_integral_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- int64_t value,
- bool is_open)
+ enum lttng_process_attr process_attr,
+ int64_t value,
+ bool is_open)
{
int ret;
const char *element_id_tracker, *element_target_id;
- ret = get_tracker_elements(
- process_attr, &element_id_tracker, &element_target_id);
+ ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
if (ret) {
return ret;
}
}
ret = mi_lttng_writer_write_element_signed_int(
- writer, config_element_process_attr_id, value);
+ writer, config_element_process_attr_id, value);
if (ret) {
goto end;
}
}
int mi_lttng_string_process_attribute_value(struct mi_writer *writer,
- enum lttng_process_attr process_attr,
- const char *value,
- bool is_open)
+ enum lttng_process_attr process_attr,
+ const char *value,
+ bool is_open)
{
int ret;
const char *element_id_tracker, *element_target_id;
- ret = get_tracker_elements(
- process_attr, &element_id_tracker, &element_target_id);
+ ret = get_tracker_elements(process_attr, &element_id_tracker, &element_target_id);
if (ret) {
return ret;
}
goto end;
}
- ret = mi_lttng_writer_write_element_string(
- writer, config_element_name, value);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, value);
if (ret) {
goto end;
}
return mi_lttng_writer_open_element(writer, mi_lttng_element_event_fields);
}
-int mi_lttng_event_field(struct mi_writer *writer,
- struct lttng_event_field *field)
+int mi_lttng_event_field(struct mi_writer *writer, struct lttng_event_field *field)
{
int ret;
}
/* Name */
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- field->field_name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, field->field_name);
if (ret) {
goto end;
}
/* Type */
- ret = mi_lttng_writer_write_element_string(writer, config_element_type,
- mi_lttng_eventfieldtype_string(field->type));
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_type, mi_lttng_eventfieldtype_string(field->type));
if (ret) {
goto end;
}
/* nowrite */
- ret = mi_lttng_writer_write_element_signed_int(writer,
- mi_lttng_element_nowrite, field->nowrite);
+ ret = mi_lttng_writer_write_element_signed_int(
+ writer, mi_lttng_element_nowrite, field->nowrite);
if (ret) {
goto end;
}
}
int mi_lttng_perf_counter_context(struct mi_writer *writer,
- struct lttng_event_perf_counter_ctx *perf_context)
+ struct lttng_event_perf_counter_ctx *perf_context)
{
int ret;
/* Open perf_counter_context */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_perf_counter_context);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_perf_counter_context);
if (ret) {
goto end;
}
/* Type */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_type, perf_context->type);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_type, perf_context->type);
if (ret) {
goto end;
}
/* Config */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- config_element_config, perf_context->config);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, config_element_config, perf_context->config);
if (ret) {
goto end;
}
/* Name of the perf counter */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_name, perf_context->name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, perf_context->name);
if (ret) {
goto end;
}
return ret;
}
-static
-int mi_lttng_app_context(struct mi_writer *writer,
- const char *provider_name, const char *ctx_name)
+static int
+mi_lttng_app_context(struct mi_writer *writer, const char *provider_name, const char *ctx_name)
{
int ret;
/* Open app */
- ret = mi_lttng_writer_open_element(writer,
- config_element_context_app);
+ ret = mi_lttng_writer_open_element(writer, config_element_context_app);
if (ret) {
goto end;
}
/* provider_name */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_context_app_provider_name,
- provider_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_context_app_provider_name, provider_name);
if (ret) {
goto end;
}
/* ctx_name */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_context_app_ctx_name, ctx_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_context_app_ctx_name, ctx_name);
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_context(struct mi_writer *writer,
- struct lttng_event_context *context, int is_open)
+int mi_lttng_context(struct mi_writer *writer, struct lttng_event_context *context, int is_open)
{
int ret;
/* Open context */
- ret = mi_lttng_writer_open_element(writer , config_element_context);
+ ret = mi_lttng_writer_open_element(writer, config_element_context);
if (ret) {
goto end;
}
case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
case LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER:
{
- struct lttng_event_perf_counter_ctx *perf_context =
- &context->u.perf_counter;
- ret = mi_lttng_perf_counter_context(writer, perf_context);
+ struct lttng_event_perf_counter_ctx *perf_context = &context->u.perf_counter;
+ ret = mi_lttng_perf_counter_context(writer, perf_context);
if (ret) {
goto end;
}
}
case LTTNG_EVENT_CONTEXT_APP_CONTEXT:
{
- ret = mi_lttng_app_context(writer,
- context->u.app_ctx.provider_name,
- context->u.app_ctx.ctx_name);
+ ret = mi_lttng_app_context(
+ writer, context->u.app_ctx.provider_name, context->u.app_ctx.ctx_name);
if (ret) {
goto end;
}
}
default:
{
- const char *type_string = mi_lttng_event_contexttype_string(
- context->ctx);
+ const char *type_string = mi_lttng_event_contexttype_string(context->ctx);
if (!type_string) {
ret = -LTTNG_ERR_INVALID;
goto end;
}
/* Print context type */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_type, type_string);
+ ret = mi_lttng_writer_write_element_string(
+ writer, config_element_type, type_string);
break;
}
}
return ret;
}
-int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
- const char *session_name)
+int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, const char *session_name)
{
int ret;
}
/* Snapshot output list for current session name */
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- session_name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, session_name);
if (ret) {
goto end;
}
}
int mi_lttng_snapshot_list_output(struct mi_writer *writer,
- const struct lttng_snapshot_output *output)
+ const struct lttng_snapshot_output *output)
{
int ret;
/* Open element snapshot output */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_command_snapshot);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
if (ret) {
goto end;
}
/* ID of the snapshot output */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_id, output->id);
+ ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, output->id);
if (ret) {
goto end;
}
/* Name of the output */
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- output->name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, output->name);
if (ret) {
goto end;
}
/* Destination of the output (ctrl_url)*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
if (ret) {
goto end;
}
/* Destination of the output (data_url) */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_data_url, output->data_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_data_url, output->data_url);
if (ret) {
goto end;
}
/* total size of all stream combined */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_snapshot_max_size, output->max_size);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_snapshot_max_size, output->max_size);
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
- const char *name, const char *current_session_name)
+int mi_lttng_snapshot_del_output(struct mi_writer *writer,
+ int id,
+ const char *name,
+ const char *current_session_name)
{
int ret;
/* Open element del_snapshot */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_command_snapshot);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
if (ret) {
goto end;
}
-
if (id != UINT32_MAX) {
/* "Snapshot output "id" successfully deleted
* for "current_session_name"
* ID of the snapshot output
*/
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_id, id);
+ ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, id);
if (ret) {
goto end;
}
* for session "current_session_name"
* Name of the output
*/
- ret = mi_lttng_writer_write_element_string(writer, config_element_name,
- name);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, name);
if (ret) {
goto end;
}
}
/* Snapshot was deleted for session "current_session_name"*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_session_name,
- current_session_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_session_name, current_session_name);
if (ret) {
goto end;
}
}
int mi_lttng_snapshot_add_output(struct mi_writer *writer,
- const char *current_session_name, const char *n_ptr,
- struct lttng_snapshot_output *output)
+ const char *current_session_name,
+ const char *n_ptr,
+ struct lttng_snapshot_output *output)
{
int ret;
/* Open element snapshot */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_command_snapshot);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
if (ret) {
goto end;
}
/* Snapshot output id */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_id, output->id);
+ ret = mi_lttng_writer_write_element_unsigned_int(writer, mi_lttng_element_id, output->id);
if (ret) {
goto end;
}
/* Snapshot output names */
- ret = mi_lttng_writer_write_element_string(writer,
- config_element_name, n_ptr);
+ ret = mi_lttng_writer_write_element_string(writer, config_element_name, n_ptr);
if (ret) {
goto end;
}
/* Destination of the output (ctrl_url)*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_ctrl_url, output->ctrl_url);
if (ret) {
goto end;
}
/* Snapshot added for session "current_session_name"*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_session_name, current_session_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_session_name, current_session_name);
if (ret) {
goto end;
}
/* total size of all stream combined */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_snapshot_max_size, output->max_size);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_snapshot_max_size, output->max_size);
if (ret) {
goto end;
}
return ret;
}
-int mi_lttng_snapshot_record(struct mi_writer *writer, const char *url,
- const char *cmdline_ctrl_url, const char *cmdline_data_url)
+int mi_lttng_snapshot_record(struct mi_writer *writer,
+ const char *url,
+ const char *cmdline_ctrl_url,
+ const char *cmdline_data_url)
{
int ret;
/* Open element snapshot */
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_command_snapshot);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_snapshot);
if (ret) {
goto end;
}
* else take the command line data and ctrl urls*/
if (url) {
/* Destination of the output (ctrl_url)*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_ctrl_url, url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_ctrl_url, url);
if (ret) {
goto end;
}
} else if (cmdline_ctrl_url) {
/* Destination of the output (ctrl_url)*/
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_ctrl_url, cmdline_ctrl_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_ctrl_url, cmdline_ctrl_url);
if (ret) {
goto end;
}
/* Destination of the output (data_url) */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_snapshot_data_url, cmdline_data_url);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_snapshot_data_url, cmdline_data_url);
if (ret) {
goto end;
}
}
int mi_lttng_rotation_schedule(struct mi_writer *writer,
- const struct lttng_rotation_schedule *schedule)
+ const struct lttng_rotation_schedule *schedule)
{
int ret = 0;
enum lttng_rotation_status status;
switch (lttng_rotation_schedule_get_type(schedule)) {
case LTTNG_ROTATION_SCHEDULE_TYPE_PERIODIC:
- status = lttng_rotation_schedule_periodic_get_period(schedule,
- &value);
+ status = lttng_rotation_schedule_periodic_get_period(schedule, &value);
element_name = mi_lttng_element_rotation_schedule_periodic;
value_name = mi_lttng_element_rotation_schedule_periodic_time_us;
break;
case LTTNG_ROTATION_SCHEDULE_TYPE_SIZE_THRESHOLD:
- status = lttng_rotation_schedule_size_threshold_get_threshold(
- schedule, &value);
+ status = lttng_rotation_schedule_size_threshold_get_threshold(schedule, &value);
element_name = mi_lttng_element_rotation_schedule_size_threshold;
value_name = mi_lttng_element_rotation_schedule_size_threshold_bytes;
break;
}
if (!empty_schedule) {
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- value_name, value);
+ ret = mi_lttng_writer_write_element_unsigned_int(writer, value_name, value);
if (ret) {
goto end;
}
}
int mi_lttng_rotation_schedule_result(struct mi_writer *writer,
- const struct lttng_rotation_schedule *schedule,
- bool success)
+ const struct lttng_rotation_schedule *schedule,
+ bool success)
{
int ret = 0;
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation_schedule_result);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_schedule_result);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation_schedule);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_schedule);
if (ret) {
goto end;
}
goto end;
}
- ret = mi_lttng_writer_write_element_bool(writer,
- mi_lttng_element_command_success, success);
+ ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_command_success, success);
if (ret) {
goto end;
}
return ret;
}
-static
-int mi_lttng_location(struct mi_writer *writer,
- const struct lttng_trace_archive_location *location)
+static int mi_lttng_location(struct mi_writer *writer,
+ const struct lttng_trace_archive_location *location)
{
int ret = 0;
enum lttng_trace_archive_location_type location_type;
{
const char *absolute_path;
- status = lttng_trace_archive_location_local_get_absolute_path(
- location, &absolute_path);
+ status = lttng_trace_archive_location_local_get_absolute_path(location,
+ &absolute_path);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation_location_local);
+ mi_lttng_element_rotation_location_local);
if (ret) {
goto end;
}
-
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_rotation_location_local_absolute_path,
- absolute_path);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ mi_lttng_element_rotation_location_local_absolute_path,
+ absolute_path);
if (ret) {
goto end;
}
enum lttng_trace_archive_location_relay_protocol_type protocol;
/* Fetch all relay location parameters. */
- status = lttng_trace_archive_location_relay_get_protocol_type(
- location, &protocol);
+ status = lttng_trace_archive_location_relay_get_protocol_type(location, &protocol);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
- status = lttng_trace_archive_location_relay_get_host(
- location, &host);
+ status = lttng_trace_archive_location_relay_get_host(location, &host);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
- status = lttng_trace_archive_location_relay_get_control_port(
- location, &control_port);
+ status = lttng_trace_archive_location_relay_get_control_port(location,
+ &control_port);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
- status = lttng_trace_archive_location_relay_get_data_port(
- location, &data_port);
+ status = lttng_trace_archive_location_relay_get_data_port(location, &data_port);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
- status = lttng_trace_archive_location_relay_get_relative_path(
- location, &relative_path);
+ status = lttng_trace_archive_location_relay_get_relative_path(location,
+ &relative_path);
if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
ret = -1;
goto end;
}
ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation_location_relay);
+ mi_lttng_element_rotation_location_relay);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_rotation_location_relay_host,
- host);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_rotation_location_relay_host, host);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_rotation_location_relay_control_port,
- control_port);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer,
+ mi_lttng_element_rotation_location_relay_control_port,
+ control_port);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_rotation_location_relay_data_port,
- data_port);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_rotation_location_relay_data_port, data_port);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_rotation_location_relay_protocol,
- mi_lttng_trace_archive_location_relay_protocol_type_string(protocol));
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ mi_lttng_element_rotation_location_relay_protocol,
+ mi_lttng_trace_archive_location_relay_protocol_type_string(protocol));
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_rotation_location_relay_relative_path,
- relative_path);
+ ret = mi_lttng_writer_write_element_string(
+ writer,
+ mi_lttng_element_rotation_location_relay_relative_path,
+ relative_path);
if (ret) {
goto end;
}
}
int mi_lttng_rotate(struct mi_writer *writer,
- const char *session_name,
- enum lttng_rotation_state rotation_state,
- const struct lttng_trace_archive_location *location)
+ const char *session_name,
+ enum lttng_rotation_state rotation_state,
+ const struct lttng_trace_archive_location *location)
{
int ret;
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation);
if (ret) {
goto end;
}
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_session_name,
- session_name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_session_name, session_name);
if (ret) {
goto end;
}
ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_rotation_state,
- mi_lttng_rotation_state_string(rotation_state));
+ mi_lttng_element_rotation_state,
+ mi_lttng_rotation_state_string(rotation_state));
if (ret) {
goto end;
}
goto close_rotation;
}
- ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_rotation_location);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_rotation_location);
if (ret) {
goto end;
}