X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fmi-lttng.h;h=e5ca544737f373bee2a56e8bbd0aef5fc4e489a1;hb=f14256d650ba78aa23c87a1f35c0c66656cb9e06;hp=6a002751a36235d941e2f4d70a51c84c258fe7ab;hpb=ce91cd0baf698b0c53f97f1101d863db87cf861a;p=lttng-tools.git diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index 6a002751a..e5ca54473 100644 --- a/src/common/mi-lttng.h +++ b/src/common/mi-lttng.h @@ -26,6 +26,9 @@ #include #include +/* Don't want to reference snapshot-internal.h here */ +struct lttng_snapshot_output; + /* Instance of a machine interface writer. */ struct mi_writer { struct config_writer *writer; @@ -47,33 +50,41 @@ struct mi_lttng_version { /* Strings related to command */ const char * const mi_lttng_element_command; -const char * const mi_lttng_element_command_name; -const char * const mi_lttng_element_command_version; -const char * const mi_lttng_element_command_enable_event; -const char * const mi_lttng_element_command_list; -const char * const mi_lttng_element_command_save; -const char * const mi_lttng_element_command_load; -const char * const mi_lttng_element_command_stop; -const char * const mi_lttng_element_command_start; +const char * const mi_lttng_element_command_action; +const char * const mi_lttng_element_command_add_context; +const char * const mi_lttng_element_command_calibrate; const char * const mi_lttng_element_command_create; const char * const mi_lttng_element_command_destroy; -const char * const mi_lttng_element_command_calibrate; -const char * const mi_lttng_element_command_add_context; +const char * const mi_lttng_element_command_disable_channel; +const char * const mi_lttng_element_command_disable_event; const char * const mi_lttng_element_command_enable_channels; -const char * const mi_lttng_element_command_set_session; +const char * const mi_lttng_element_command_enable_event; +const char * const mi_lttng_element_command_list; +const char * const mi_lttng_element_command_load; +const char * const mi_lttng_element_command_name; const char * const mi_lttng_element_command_output; +const char * const mi_lttng_element_command_save; +const char * const mi_lttng_element_command_set_session; +const char * const mi_lttng_element_command_snapshot; +const char * const mi_lttng_element_command_snapshot_add; +const char * const mi_lttng_element_command_snapshot_del; +const char * const mi_lttng_element_command_snapshot_list; +const char * const mi_lttng_element_command_snapshot_record; +const char * const mi_lttng_element_command_start; +const char * const mi_lttng_element_command_stop; const char * const mi_lttng_element_command_success; +const char * const mi_lttng_element_command_version; /* Strings related to version command */ const char * const mi_lttng_element_version; -const char * const mi_lttng_element_version_str; -const char * const mi_lttng_element_version_web; +const char * const mi_lttng_element_version_commit; +const char * const mi_lttng_element_version_description; +const char * const mi_lttng_element_version_license; const char * const mi_lttng_element_version_major; const char * const mi_lttng_element_version_minor; -const char * const mi_lttng_element_version_license; -const char * const mi_lttng_element_version_commit; const char * const mi_lttng_element_version_patch_level; -const char * const mi_lttng_element_version_description; +const char * const mi_lttng_element_version_str; +const char * const mi_lttng_element_version_web; /* String related to a lttng_event_field */ const char * const mi_lttng_element_event_field; @@ -99,13 +110,15 @@ const char * const mi_lttng_element_save; const char * const mi_lttng_element_load; /* General element of mi_lttng */ -const char * const mi_lttng_element_type_other; -const char * const mi_lttng_element_type_integer; +const char * const mi_lttng_element_empty; +const char * const mi_lttng_element_id; +const char * const mi_lttng_element_nowrite; +const char * const mi_lttng_element_success; const char * const mi_lttng_element_type_enum; const char * const mi_lttng_element_type_float; +const char * const mi_lttng_element_type_integer; +const char * const mi_lttng_element_type_other; const char * const mi_lttng_element_type_string; -const char * const mi_lttng_element_nowrite; -const char * const mi_lttng_element_success; /* String related to loglevel */ const char * const mi_lttng_loglevel_str_alert; @@ -125,6 +138,17 @@ const char * const mi_lttng_loglevel_str_notice; const char * const mi_lttng_loglevel_str_unknown; const char * const mi_lttng_loglevel_str_warning; +/* String related to loglevel JUL */ +const char * const mi_lttng_loglevel_str_jul_all; +const char * const mi_lttng_loglevel_str_jul_config; +const char * const mi_lttng_loglevel_str_jul_fine; +const char * const mi_lttng_loglevel_str_jul_finer; +const char * const mi_lttng_loglevel_str_jul_finest; +const char * const mi_lttng_loglevel_str_jul_info; +const char * const mi_lttng_loglevel_str_jul_off; +const char * const mi_lttng_loglevel_str_jul_severe; +const char * const mi_lttng_loglevel_str_jul_warning; + /* String related to loglevel type */ const char * const mi_lttng_loglevel_type_all; const char * const mi_lttng_loglevel_type_range; @@ -135,6 +159,14 @@ const char * const mi_lttng_loglevel_type_unknown; const char * const mi_lttng_element_calibrate; const char * const mi_lttng_element_calibrate_function; +/* String related to a lttng_snapshot */ +const char * const mi_lttng_element_snapshot_ctrl_url; +const char * const mi_lttng_element_snapshot_data_url; +const char * const mi_lttng_element_snapshot_max_size; +const char * const mi_lttng_element_snapshot_n_ptr; +const char * const mi_lttng_element_snapshot_session_name; +const char * const mi_lttng_element_snapshots; + /* Utility string function */ const char *mi_lttng_loglevel_string(int value); const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value); @@ -303,7 +335,7 @@ int mi_lttng_sessions_open(struct mi_writer *writer); * is_open Defines whether or not the session element shall be closed. * This should be used carefully and the client * must close the session element. - * Use case: nested addtionnal information on a session + * Use case: nested additional information on a session * ex: domain,channel event. * * Returns zero if the element's value could be written. @@ -496,7 +528,7 @@ int mi_lttng_event_field(struct mi_writer *writer, * * writer An instance of a machine interface writer. * - * Returns zero if the element could be written. + * Returns zero if the element have be written. * Negative values indicate an error. */ int mi_lttng_event_fields_open(struct mi_writer *writer); @@ -552,8 +584,6 @@ int mi_lttng_calibrate(struct mi_writer *writer, * is_open Define if we close the context element * This should be used carefully and the client * need to close the context element. - * 0-> False - * 1-> True * Returns zero if the element's value could be written. * Negative values indicate an error. */ @@ -573,4 +603,117 @@ int mi_lttng_context(struct mi_writer *writer, int mi_lttng_perf_counter_context(struct mi_writer *writer, struct lttng_event_perf_counter_ctx *perf_context); +/* + * Machine interface of the snapshot list_output. + * It specifies the session for which we are listing snapshots, + * and it opens a snapshots element to list a sequence + * of snapshots. + * + * writer An instance of a machine interface writer. + * + * session_name: Snapshot output for session "session_name". + * + * Note: The client has to close the session and the snapshots elements after + * having listed every lttng_snapshot_output. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_snapshot_output_session_name(struct mi_writer *writer, + const char *session_name); + +/* + * Machine interface of the snapshot output. + * The machine interface serializes the following attributes: + * - id: ID of the snapshot output. + * - name: Name of the output. + * - data_url : Destination of the output. + * - ctrl_url: Destination of the output. + * - max_size: total size of all stream combined. + * + * writer An instance of a machine interface writer. + * + * output: A list of snapshot_output. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_snapshot_list_output(struct mi_writer *writer, + struct lttng_snapshot_output *output); + +/* + * Machine interface of the output of the command snapshot del output + * when deleting a snapshot either by id or by name. + * If the snapshot was found and successfully deleted using its id, + * it return the id of the snapshot and the current session name on which it + * was attached. + * + * Otherwise, it do the same process with the name of the snapshot, if the + * snapshot output id is undefined. + * + * writer An instance of a machine interface writer. + * + * id: ID of the snapshot output. + * + * name: Name of the snapshot. + * + * current_session_name: Session to which the snapshot belongs. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id, + const char *name, const char *current_session_name); + +/* + * Machine interface of the output of the command snapshot add output + * when adding a snapshot from a user URL. + * + * If the snapshot was successfully added, the machine interface lists + * these information: + * - id: ID of the newly add snapshot output. + * - current_session_name: Name of the session to which the output was added. + * - ctrl_url: Destination of the output. + * - max_size: total size of all stream combined. + * + * writer An instance of a machine interface writer. + * + * current_session_name: Session to which the snapshot belongs. + * + * n_ptr: + * + * output: iterator over a lttng_snapshot_output_list which contain + * the snapshot output informations. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_snapshot_add_output(struct mi_writer *writer, + const char *current_session_name, const char *n_ptr, + struct lttng_snapshot_output *output); + +/* + * Machine interface of the output of the command snapshot + * record from a URL (if given). + * + * If the snapshot is successfully recorded from a url, the machine interface + * output the following information: + * - url: Destination of the output stored in the snapshot. + * + * Otherwise, the machine interface output the data and ctrl url received + * from the command-line. + * + * writer An instance of a machine interface writer. + * + * current_session_name: Snapshot record for session "current_session_name". + * + * ctrl_url, data_url: Destination of the output receive from the command-line. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_snapshot_record(struct mi_writer *writer, + const char *current_session_name, const char *url, + const char *cmdline_ctrl_url, const char *cmdline_data_url); + #endif /* _MI_LTTNG_H */