X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fevents-internal.h;h=097f5e979723c8a3969f82f3e60e729fb63162ef;hb=b0315544e745613aadcdfefe0c4c336689648c66;hp=f0d0b0dabd30c3eb02014fd2ec4036e9e78e424f;hpb=8a20497ff97f1d3252c753f33c809ac6333589c8;p=lttng-modules.git diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index f0d0b0da..097f5e97 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -216,7 +216,7 @@ struct lttng_kernel_ctx_field { size_t (*get_size)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset); void (*record)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, - struct lib_ring_buffer_ctx *ctx, + struct lttng_kernel_ring_buffer_ctx *ctx, struct lttng_channel *chan); void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, struct lttng_ctx_value *value); @@ -243,6 +243,139 @@ struct lttng_metadata_cache { uint64_t version; /* Current version of the metadata */ }; +struct lttng_kernel_channel_buffer_ops_private { + struct lttng_kernel_channel_buffer_ops *pub; /* Public channel buffer ops interface */ + + struct channel *(*channel_create)(const char *name, + void *priv, + void *buf_addr, + size_t subbuf_size, size_t num_subbuf, + unsigned int switch_timer_interval, + unsigned int read_timer_interval); + void (*channel_destroy)(struct channel *chan); + struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); + int (*buffer_has_read_closed_stream)(struct channel *chan); + void (*buffer_read_close)(struct lib_ring_buffer *buf); + /* + * packet_avail_size returns the available size in the current + * packet. Note that the size returned is only a hint, since it + * may change due to concurrent writes. + */ + size_t (*packet_avail_size)(struct channel *chan); + wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); + wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); + int (*is_finalized)(struct channel *chan); + int (*is_disabled)(struct channel *chan); + int (*timestamp_begin) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *timestamp_begin); + int (*timestamp_end) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *timestamp_end); + int (*events_discarded) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *events_discarded); + int (*content_size) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *content_size); + int (*packet_size) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *packet_size); + int (*stream_id) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *stream_id); + int (*current_timestamp) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *ts); + int (*sequence_number) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *seq); + int (*instance_id) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *id); +}; + +struct lttng_counter_ops { + struct lib_counter *(*counter_create)(size_t nr_dimensions, + const size_t *max_nr_elem, /* for each dimension */ + int64_t global_sum_step); + void (*counter_destroy)(struct lib_counter *counter); + int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, + int64_t v); + /* + * counter_read reads a specific cpu's counter if @cpu >= 0, or + * the global aggregation counter if @cpu == -1. + */ + int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, + int64_t *value, bool *overflow, bool *underflow); + /* + * counter_aggregate returns the total sum of all per-cpu counters and + * the global aggregation counter. + */ + int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, + int64_t *value, bool *overflow, bool *underflow); + int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); +}; + +struct lttng_counter { + struct file *file; /* File associated to counter. */ + struct file *owner; + struct lttng_counter_transport *transport; + struct lib_counter *counter; + struct lttng_counter_ops *ops; +}; + +struct lttng_event_notifier_group { + struct file *file; /* File associated to event notifier group */ + struct file *notif_file; /* File used to expose notifications to userspace. */ + struct list_head node; /* event notifier group list */ + struct list_head enablers_head; /* List of enablers */ + struct list_head event_notifiers_head; /* List of event notifier */ + struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */ + struct lttng_kernel_channel_buffer_ops *ops; + struct lttng_transport *transport; + struct channel *chan; /* Ring buffer channel for event notifier group. */ + struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ + wait_queue_head_t read_wait; + struct irq_work wakeup_pending; /* Pending wakeup irq work. */ + struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ + struct lttng_kernel_event_notifier *sc_compat_unknown; + + struct lttng_syscall_filter *sc_filter; + + struct hlist_head *event_notifier_syscall_dispatch; + struct hlist_head *event_notifier_compat_syscall_dispatch; + struct hlist_head *event_notifier_exit_syscall_dispatch; + struct hlist_head *event_notifier_exit_compat_syscall_dispatch; + + struct hlist_head event_notifier_unknown_syscall_dispatch; + struct hlist_head event_notifier_compat_unknown_syscall_dispatch; + struct hlist_head event_notifier_exit_unknown_syscall_dispatch; + struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; + + int syscall_all_entry; + int syscall_all_exit; + + unsigned int sys_enter_registered:1, sys_exit_registered:1; + + struct lttng_counter *error_counter; + size_t error_counter_len; +}; + +struct lttng_transport { + char *name; + struct module *owner; + struct list_head node; + struct lttng_kernel_channel_buffer_ops ops; +}; + +struct lttng_counter_transport { + char *name; + struct module *owner; + struct list_head node; + struct lttng_counter_ops ops; +}; + extern struct lttng_kernel_ctx *lttng_static_ctx; static inline