X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Flttng.h;h=5e0a9412325a1e4697fa69454d94504f40fe3a29;hb=dad47fc4c65ec0acbfedc676895833b465d25cd6;hp=bde46fa60337fb8ff07b2410e92478c5b167d5db;hpb=a54bd42d73836eb9033a31c3f68be5b7e8612dce;p=lttng-tools.git diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index bde46fa60..5e0a94123 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -27,19 +27,10 @@ #include #include -/* Default unix group name for tracing. */ -#define LTTNG_DEFAULT_TRACING_GROUP "tracing" - -/* Environment variable to set session daemon binary path. */ -#define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" - -/* Default trace output directory name */ -#define LTTNG_DEFAULT_TRACE_DIR_NAME "lttng-traces" - /* * Event symbol length. Copied from LTTng kernel ABI. */ -#define LTTNG_SYMBOL_NAME_LEN 128 +#define LTTNG_SYMBOL_NAME_LEN 256 /* * Every lttng_event_* structure both apply to kernel event and user-space @@ -52,47 +43,64 @@ enum lttng_domain_type { LTTNG_DOMAIN_KERNEL = 1, LTTNG_DOMAIN_UST = 2, + + /* + * For now, the domains below are not implemented. However, we keep them + * here in order to retain their enum values for future development. Note + * that it is on the roadmap to implement them. + * LTTNG_DOMAIN_UST_EXEC_NAME = 3, LTTNG_DOMAIN_UST_PID = 4, LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN = 5, + */ }; /* * Instrumentation type of tracing event. */ enum lttng_event_type { - LTTNG_EVENT_TRACEPOINT, - LTTNG_EVENT_PROBE, - LTTNG_EVENT_FUNCTION, - LTTNG_EVENT_FUNCTION_ENTRY, - LTTNG_EVENT_NOOP, - LTTNG_EVENT_SYSCALL, + LTTNG_EVENT_ALL = -1, + LTTNG_EVENT_TRACEPOINT = 0, + LTTNG_EVENT_PROBE = 1, + LTTNG_EVENT_FUNCTION = 2, + LTTNG_EVENT_FUNCTION_ENTRY = 3, + LTTNG_EVENT_NOOP = 4, + LTTNG_EVENT_SYSCALL = 5, +}; + +/* + * Loglevel information. + */ +enum lttng_loglevel_type { + LTTNG_EVENT_LOGLEVEL = 0, + LTTNG_EVENT_LOGLEVEL_ONLY = 1, }; /* * LTTng consumer mode */ enum lttng_event_output { - LTTNG_EVENT_SPLICE = 0, - LTTNG_EVENT_MMAP = 1, + LTTNG_EVENT_SPLICE = 0, + LTTNG_EVENT_MMAP = 1, }; /* Event context possible type */ enum lttng_event_context_type { - LTTNG_EVENT_CONTEXT_PID = 0, - LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, - LTTNG_EVENT_CONTEXT_COMM = 2, - LTTNG_EVENT_CONTEXT_PRIO = 3, - LTTNG_EVENT_CONTEXT_NICE = 4, - LTTNG_EVENT_CONTEXT_VPID = 5, - LTTNG_EVENT_CONTEXT_TID = 6, - LTTNG_EVENT_CONTEXT_VTID = 7, - LTTNG_EVENT_CONTEXT_PPID = 8, - LTTNG_EVENT_CONTEXT_VPPID = 9, + LTTNG_EVENT_CONTEXT_PID = 0, + LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, + LTTNG_EVENT_CONTEXT_PROCNAME = 2, + LTTNG_EVENT_CONTEXT_PRIO = 3, + LTTNG_EVENT_CONTEXT_NICE = 4, + LTTNG_EVENT_CONTEXT_VPID = 5, + LTTNG_EVENT_CONTEXT_TID = 6, + LTTNG_EVENT_CONTEXT_VTID = 7, + LTTNG_EVENT_CONTEXT_PPID = 8, + LTTNG_EVENT_CONTEXT_VPPID = 9, + LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, }; enum lttng_calibrate_type { - LTTNG_CALIBRATE_FUNCTION = 0, + LTTNG_CALIBRATE_FUNCTION = 0, }; struct lttng_domain { @@ -141,9 +149,15 @@ struct lttng_event_function_attr { * Generic lttng event */ struct lttng_event { - char name[LTTNG_SYMBOL_NAME_LEN]; enum lttng_event_type type; + char name[LTTNG_SYMBOL_NAME_LEN]; + + enum lttng_loglevel_type loglevel_type; + char loglevel[LTTNG_SYMBOL_NAME_LEN]; + int64_t loglevel_value; /* for printing */ + uint32_t enabled; + pid_t pid; /* Per event type configuration */ union { struct lttng_event_probe_attr probe; @@ -167,7 +181,7 @@ struct lttng_channel_attr { * Channel information structure. For both kernel and user-space. */ struct lttng_channel { - char name[NAME_MAX]; + char name[LTTNG_SYMBOL_NAME_LEN]; uint32_t enabled; struct lttng_channel_attr attr; }; @@ -187,6 +201,7 @@ struct lttng_session { char name[NAME_MAX]; /* The path where traces are written */ char path[PATH_MAX]; + uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */ }; /* @@ -207,7 +222,7 @@ struct lttng_handle { * array. * * On error, a negative value is returned being a specific lttng-tools error - * code which can be humanly interpreted with lttng_get_readable_code(err). + * code which can be humanly interpreted with lttng_strerror(err). */ /* @@ -236,7 +251,7 @@ extern int lttng_create_session(const char *name, const char *path); * The session will not be useable anymore, tracing will stopped for all * registered trace and tracing buffers will be flushed. */ -extern int lttng_destroy_session(struct lttng_handle *handle); +extern int lttng_destroy_session(const char *name); /* * List all tracing sessions. @@ -250,7 +265,7 @@ extern int lttng_list_sessions(struct lttng_session **sessions); * * Return the size of the "lttng_domain" array. Caller must free(3). */ -extern int lttng_list_domains(struct lttng_handle *handle, +extern int lttng_list_domains(const char *session_name, struct lttng_domain **domains); /* @@ -292,14 +307,14 @@ extern int lttng_set_tracing_group(const char *name); * * Parameter MUST be a negative value or else you'll get a generic message. */ -extern const char *lttng_get_readable_code(int code); +extern const char *lttng_strerror(int code); /* * This call permits to register an "outside consumer" to a session and a lttng * domain. No consumer will be spawned and all fds/commands will go through the * socket path given (socket_path). * - * NOTE: At the moment, if you use the liblttngkconsumerd, you can only use the + * NOTE: At the moment, if you use the liblttng-kconsumer, you can only use the * command socket. The error socket is not supported yet for roaming consumers. */ extern int lttng_register_consumer(struct lttng_handle *handle, @@ -308,12 +323,12 @@ extern int lttng_register_consumer(struct lttng_handle *handle, /* * Start tracing for *all* registered trace (kernel and user-space). */ -extern int lttng_start_tracing(struct lttng_handle *handle); +extern int lttng_start_tracing(const char *session_name); /* * Stop tracing for *all* registered trace (kernel and user-space). */ -extern int lttng_stop_tracing(struct lttng_handle *handle); +extern int lttng_stop_tracing(const char *session_name); /* * Add context to event for a specific channel. @@ -367,4 +382,11 @@ extern int lttng_disable_channel(struct lttng_handle *handle, extern int lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate *calibrate); +/* + * Set the default channel attributes for a specific domain and an allocated + * lttng_channel_attr pointer. + */ +extern void lttng_channel_set_default_attr(struct lttng_domain *domain, + struct lttng_channel_attr *attr); + #endif /* _LTTNG_H */