X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt-sessiond%2Ftrace.h;h=444126ba01e4322c7727a3341f85fd13467e8e90;hb=4625876527524eafaa15a55ddcb68258e8235dd7;hp=9cbdaffd1dbb1da13f02d3ff80e6444b6b98df95;hpb=fda89c9b0a068c6d528e1ef9095476118708c181;p=lttng-tools.git diff --git a/ltt-sessiond/trace.h b/ltt-sessiond/trace.h index 9cbdaffd1..444126ba0 100644 --- a/ltt-sessiond/trace.h +++ b/ltt-sessiond/trace.h @@ -19,16 +19,79 @@ #ifndef _LTT_TRACE_H #define _LTT_TRACE_H -/* LTTng trace representation */ -struct ltt_lttng_trace { +#include +#include +#include "lttng-kernel.h" + +/* Default kernel channel attributes */ +#define DEFAULT_KERNEL_OVERWRITE 0 +#define DEFAULT_KERNEL_SUBBUF_SIZE 4096 /* bytes */ +#define DEFAULT_KERNEL_SUBBUF_NUM 8 /* Must always be a power of 2 */ +#define DEFAULT_KERNEL_SWITCH_TIMER 0 /* usec */ +#define DEFAULT_KERNEL_READ_TIMER 200 /* usec */ + +/* Kernel event list */ +struct ltt_kernel_event_list { + struct cds_list_head head; +}; + +/* Channel stream list */ +struct ltt_kernel_stream_list { + struct cds_list_head head; +}; + +/* Channel list */ +struct ltt_kernel_channel_list { + struct cds_list_head head; +}; + +/* Kernel event */ +struct ltt_kernel_event { + int fd; + struct lttng_kernel_event *event; + struct cds_list_head list; +}; + +/* Kernel channel */ +struct ltt_kernel_channel { + int fd; + char *pathname; + unsigned int stream_count; + struct lttng_kernel_channel *channel; + struct ltt_kernel_event_list events_list; + struct ltt_kernel_stream_list stream_list; + struct cds_list_head list; +}; + +/* Metadata */ +struct ltt_kernel_metadata { + int fd; + char *pathname; + struct lttng_kernel_channel *conf; +}; + +/* Channel stream */ +struct ltt_kernel_stream { + int fd; + char *pathname; + int state; struct cds_list_head list; - char trace_name[NAME_MAX]; - struct cds_list_head marker_list; +}; + +/* Kernel session */ +struct ltt_kernel_session { + int fd; + int metadata_stream_fd; + unsigned int channel_count; + unsigned int stream_count_global; + struct ltt_kernel_metadata *metadata; + struct ltt_kernel_channel_list channel_list; }; /* UST trace representation */ struct ltt_ust_trace { struct cds_list_head list; + char name[NAME_MAX]; int shmid; pid_t pid; struct cds_list_head markers; @@ -40,4 +103,24 @@ struct ltt_ust_marker { char *channel; }; +/* + * Create functions malloc() the data structure. + */ +struct ltt_kernel_session *trace_create_kernel_session(void); +struct ltt_kernel_channel *trace_create_kernel_channel(void); +struct ltt_kernel_event *trace_create_kernel_event(char *name, + enum lttng_kernel_instrumentation type); +struct ltt_kernel_metadata *trace_create_kernel_metadata(void); +struct ltt_kernel_stream *trace_create_kernel_stream(void); + +/* + * Destroy functions free() the data structure and remove from linked list if + * it's applies. + */ +void trace_destroy_kernel_session(struct ltt_kernel_session *session); +void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata); +void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel); +void trace_destroy_kernel_event(struct ltt_kernel_event *event); +void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream); + #endif /* _LTT_TRACE_H */