b8485c35accbb62eecffae6da191bcf87905d888
[lttng-modules.git] / ltt-events.h
1 /*
2 * ltt-events.h
3 *
4 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * Holds LTTng per-session event registry.
7 */
8
9 #include <linux/list.h>
10
11 struct ltt_channel;
12 struct ltt_session;
13
14 enum instrum_type itype {
15 INSTRUM_TRACEPOINTS,
16 };
17
18 /*
19 * ltt_event structure is referred to by the tracing fast path. It must be
20 * kept small.
21 */
22 struct ltt_event {
23 unsigned int id;
24 struct ltt_channel *chan;
25 void *probe;
26 void *filter;
27 char *name;
28 enum instrum_type itype;
29 struct list_head list; /* Event list */
30 };
31
32 struct ltt_channel {
33 struct channel *chan; /* Channel buffers */
34 /* Event ID management */
35 struct ltt_session *session;
36 struct file *file; /* File associated to channel */
37 unsigned int free_event_id; /* Next event ID to allocate */
38 struct list_head list; /* Channel list */
39 wait_queue_head_t notify_wait; /* Channel addition notif. waitqueue */
40 };
41
42 struct ltt_session {
43 int active; /* Is trace session active ? */
44 struct file *file; /* File associated to session */
45 struct list_head chan; /* Channel list head */
46 struct list_head events; /* Event list head */
47 struct list_head list; /* Session list */
48 };
49
50 struct ltt_trace_ops {
51 struct channel *(*channel_create)(const char *name,
52 struct ltt_trace *trace,
53 void *buf_addr,
54 size_t subbuf_size, size_t num_subbuf,
55 unsigned int switch_timer_interval,
56 unsigned int read_timer_interval);
57 void (*channel_destroy)(struct channel *chan);
58 struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
59 struct lib_ring_buffer *(*buffer_read_close)(struct lib_ring_buffer *buf);
60 };
61
62 struct ltt_transport {
63 char *name;
64 struct module *owner;
65 struct list_head node;
66 struct ltt_trace_ops ops;
67 };
68
69 struct ltt_session *ltt_session_create(void);
70 int ltt_session_start(struct ltt_session *session);
71 int ltt_session_stop(struct ltt_session *session);
72 int ltt_session_destroy(struct ltt_session *session);
73
74 struct ltt_channel *ltt_channel_create(struct ltt_session *session,
75 int overwrite, void *buf_addr,
76 size_t subbuf_size, size_t num_subbuf,
77 unsigned int switch_timer_interval,
78 unsigned int read_timer_interval);
79 int _ltt_channel_destroy(struct ltt_channel *chan);
80
81 struct ltt_event *ltt_event_create(struct ltt_channel *chan,
82 enum instrum_type itype,
83 char *name,
84 void *filter);
85 int _ltt_event_destroy(struct ltt_event *event);
86
87 void ltt_transport_register(struct ltt_transport *transport);
88 void ltt_transport_unregister(struct ltt_transport *transport);
This page took 0.029865 seconds and 3 git commands to generate.