/* Strings related to command */
const char * const mi_lttng_element_command = "command";
-const char * const mi_lttng_element_command_name = "name";
-const char * const mi_lttng_element_command_version = "version";
+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_calibrate = "calibrate";
+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_save = "save";
const char * const mi_lttng_element_command_load = "load";
+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_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_create = "create";
-const char * const mi_lttng_element_command_destroy = "destroy";
-const char * const mi_lttng_element_command_calibrate = "calibrate";
-const char * const mi_lttng_element_command_add_context = "add-context";
-const char * const mi_lttng_element_command_enable_channels = "enable-channel";
-const char * const mi_lttng_element_command_set_session = "set-session";
-const char * const mi_lttng_element_command_disable_event = "disable-event";
-const char * const mi_lttng_element_command_disable_channel = "disable-channel";
-const char * const mi_lttng_element_command_action = "snapshot_action";
-const char * const mi_lttng_element_command_output = "output";
const char * const mi_lttng_element_command_success = "success";
+const char * const mi_lttng_element_command_version = "version";
/* Strings related to version command */
const char * const mi_lttng_element_version = "version";
-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_major = "major";
-const char * const mi_lttng_element_version_minor = "minor";
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_description = "description";
-const char * const mi_lttng_element_command_snapshot = "snapshot";
-const char * const mi_lttng_element_command_list_snapshot = "list_snapshot";
-const char * const mi_lttng_element_command_del_snapshot = "del_snapshot";
-const char * const mi_lttng_element_command_add_snapshot = "add_snapshot";
-const char * const mi_lttng_element_command_record_snapshot = "record_snapshot";
-
-/* Strings related to pid */
-const char * const mi_lttng_element_pids = "pids";
-const char * const mi_lttng_element_pid = "pid";
-
-/* Strings related to save command */
-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_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";
/* String related to lttng_event_perf_counter_ctx */
const char * const mi_lttng_element_perf_counter_context = "perf_counter_context";
+/* Strings related to pid */
+const char * const mi_lttng_element_pids = "pids";
+const char * const mi_lttng_element_pid = "pid";
+const char * const mi_lttng_element_pid_id = "id";
+
+/* Strings related to save command */
+const char * const mi_lttng_element_save = "save";
+
+/* Strings related to load command */
+const char * const mi_lttng_element_load = "load";
+
/* General elements of mi_lttng */
-const char * const mi_lttng_element_type_other = "OTHER";
-const char * const mi_lttng_element_type_integer = "INTEGER";
+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_nowrite = "nowrite";
-const char * const mi_lttng_element_success = "success";
-const char * const mi_lttng_element_id = "id";
-const char * const mi_lttng_element_empty = "";
/* String related to loglevel */
const char * const mi_lttng_loglevel_str_alert = "TRACE_ALERT";
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";
+
/* 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_element_calibrate_function = "FUNCTION";
/* String related to a lttng_snapshot_output */
-const char * const mi_lttng_element_snapshots = "snapshots";
-const char * const mi_lttng_element_snapshot_session_name = "session_name";
-const char * const mi_lttng_element_snapshot_n_ptr = "n_ptr";
-const char * const mi_lttng_element_snapshot_data_url = "data_url";
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";
+/* This is a merge of jul loglevel and regular loglevel
+ * Those should never overlap by definition
+ * (see struct lttng_event loglevel)
+ */
const char *mi_lttng_loglevel_string(int value)
{
switch (value) {
return mi_lttng_loglevel_str_debug_line;
case LTTNG_LOGLEVEL_DEBUG:
return mi_lttng_loglevel_str_debug;
+ case LTTNG_LOGLEVEL_JUL_OFF:
+ return mi_lttng_loglevel_str_jul_off;
+ case LTTNG_LOGLEVEL_JUL_SEVERE:
+ return mi_lttng_loglevel_str_jul_severe;
+ case LTTNG_LOGLEVEL_JUL_WARNING:
+ return mi_lttng_loglevel_str_jul_warning;
+ case LTTNG_LOGLEVEL_JUL_INFO:
+ return mi_lttng_loglevel_str_jul_info;
+ case LTTNG_LOGLEVEL_JUL_CONFIG:
+ return mi_lttng_loglevel_str_jul_config;
+ case LTTNG_LOGLEVEL_JUL_FINE:
+ return mi_lttng_loglevel_str_jul_fine;
+ case LTTNG_LOGLEVEL_JUL_FINER:
+ return mi_lttng_loglevel_str_jul_finer;
+ case LTTNG_LOGLEVEL_JUL_FINEST:
+ return mi_lttng_loglevel_str_jul_finest;
+ case LTTNG_LOGLEVEL_JUL_ALL:
+ return mi_lttng_loglevel_str_jul_all;
default:
return mi_lttng_loglevel_str_unknown;
}
return config_domain_type_ust;
case LTTNG_DOMAIN_JUL:
return config_domain_type_jul;
+ case LTTNG_DOMAIN_LOG4J:
+ return config_domain_type_log4j;
default:
/* Should not have an unknown domain */
assert(0);
goto end;
}
if (mi_output_type == LTTNG_MI_XML) {
- mi_writer->writer = config_writer_create(fd_output);
+ mi_writer->writer = config_writer_create(fd_output, 0);
if (!mi_writer->writer) {
goto err_destroy;
}
/* Version string (contain info like rc etc.) */
ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_version_str, VERSION);
+ mi_lttng_element_version_str, version->version);
if (ret) {
goto end;
}
goto end;
}
- /* TODO: attr... not sure how to use the union.... */
+ /* TODO: union attr
+ * This union is not currently used and was added for
+ * future ust domain support.
+ * Date: 25-06-2014
+ * */
if (!is_open) {
/* Closing domain element */
goto end;
}
- /* event name */
+ /* Event name */
ret = mi_lttng_writer_write_element_string(writer,
config_element_name, event->name);
if (ret) {
goto end;
}
- /* event type */
+ /* 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 */
+ /* Is event enabled */
ret = mi_lttng_writer_write_element_bool(writer,
config_element_enabled, event->enabled);
if (ret) {
goto end;
}
- /* event filter enabled? */
+ /* Event filter enabled? */
ret = mi_lttng_writer_write_element_bool(writer,
config_element_filter, event->filter);
{
int ret;
- /* event loglevel */
+ /* Event loglevel */
ret = mi_lttng_writer_write_element_string(writer,
config_element_loglevel, mi_lttng_loglevel_string(event->loglevel));
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));
{
int ret;
+ ret = mi_lttng_writer_open_element(writer, config_element_attributes);
+ if (ret) {
+ goto end;
+ }
+
+ ret = mi_lttng_writer_open_element(writer, config_element_probe_attributes);
+ if (ret) {
+ goto end;
+ }
+
if (event->attr.probe.addr != 0) {
/* event probe address */
ret = mi_lttng_writer_write_element_unsigned_int(writer,
goto end;
}
}
+
+ /* Close probe_attributes and attributes */
+ ret = mi_lttng_close_multi_element(writer, 2);
end:
return ret;
}
int mi_lttng_event_function_entry(struct mi_writer *writer,
struct lttng_event *event)
{
+ int ret;
+
+ ret = mi_lttng_writer_open_element(writer, config_element_attributes);
+ if (ret) {
+ goto end;
+ }
+
+ ret = mi_lttng_writer_open_element(writer, config_element_probe_attributes);
+ if (ret) {
+ goto end;
+ }
+
/* event probe symbol_name */
- return mi_lttng_writer_write_element_string(writer,
+ ret = mi_lttng_writer_write_element_string(writer,
config_element_symbol_name, event->attr.ftrace.symbol_name);
+ if (ret) {
+ goto end;
+ }
+
+ /* Close function_attributes and attributes */
+ ret = mi_lttng_close_multi_element(writer, 2);
+end:
+ return ret;
}
LTTNG_HIDDEN
}
break;
}
+ case LTTNG_EVENT_FUNCTION:
+ /* Fallthrough */
case LTTNG_EVENT_PROBE:
ret = mi_lttng_event_function_probe(writer, event);
break;
int ret;
if (!field->field_name[0]) {
- /* To Review: not sure if legal david ?
- * how should this be handle ?
- */
ret = 0;
goto end;
}