X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fmi-lttng.h;h=476310ba404c5655345e1b6e3699ac5b643b2fce;hp=4b2b035e04a66d1d55c9036103975e3ce90a3612;hb=f4a088f723845847249e069fea4d0c1b579d5fd1;hpb=acc0921507a42345aa6b032231180c7c6999f55a diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index 4b2b035e0..476310ba4 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,31 +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_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_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; @@ -97,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; @@ -133,6 +148,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_snashot */ +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); @@ -494,7 +517,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); @@ -550,8 +573,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. */ @@ -571,4 +592,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 */