X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fmi-lttng.h;h=e5ca544737f373bee2a56e8bbd0aef5fc4e489a1;hp=0f263fc5a69710bfc96efa5e7812d6a20c33bece;hb=136f2f81ca23f95585af57b773d7bc4e04407cda;hpb=65f25c661e03316f5f0cb4a035df518c875c17f8 diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index 0f263fc5a..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,54 @@ 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_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; const char * const mi_lttng_element_event_fields; +/* String related to lttng_event_context */ +const char * const mi_lttng_context_type_perf_counter; +const char * const mi_lttng_context_type_perf_cpu_counter; +const char * const mi_lttng_context_type_perf_thread_counter; + +/* String related to lttng_event_perf_counter_ctx */ +const char * const mi_lttng_element_perf_counter_context; + /* Strings related to pid */ const char * const mi_lttng_element_pids; const char * const mi_lttng_element_pid; @@ -86,12 +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; /* String related to loglevel */ const char * const mi_lttng_loglevel_str_alert; @@ -111,18 +138,42 @@ 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; const char * const mi_lttng_loglevel_type_single; const char * const mi_lttng_loglevel_type_unknown; +/* Sting related to lttng_calibrate */ +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); const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value); const char *mi_lttng_domaintype_string(enum lttng_domain_type value); const char *mi_lttng_buffertype_string(enum lttng_buffer_type value); +const char *mi_lttng_calibratetype_string(enum lttng_calibrate_type val); /* * Create an instance of a machine interface writer. @@ -284,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. @@ -477,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's value 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); @@ -510,4 +561,159 @@ int mi_lttng_pids_open(struct mi_writer *writer); int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *cmdline, int is_open); +/* + * Machine interface for struct lttng_calibrate. + * + * writer An instance of a machine interface writer. + * + * calibrate A lttng_calibrate instance. + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_calibrate(struct mi_writer *writer, + struct lttng_calibrate *calibrate); + +/* + * Machine interface of a context. + * + * writer An instance of a machine interface writer + * + * context An instance of a lttng_event_context + * + * is_open Define if we close the context element + * This should be used carefully and the client + * need to close the context element. + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +int mi_lttng_context(struct mi_writer *writer, + struct lttng_event_context *context, int is_open); + +/* + * Machine interface of a perf_counter_context. + * + * writer An instance of a machine interface writer + * + * contest An instance of a lttng_event_perf_counter_ctx + * + * Returns zero if the element's value could be written. + * Negative values indicate an error. + */ +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 */