7 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Holds LTTng per-session event registry.
12 #include <linux/list.h>
13 #include "ltt-debugfs-abi.h"
17 struct lib_ring_buffer_ctx
;
20 * ltt_event structure is referred to by the tracing fast path. It must be
25 struct ltt_channel
*chan
;
29 enum instrum_type itype
;
30 struct list_head list
; /* Event list */
33 struct ltt_channel_ops
{
34 struct channel
*(*channel_create
)(const char *name
,
35 struct ltt_session
*session
,
37 size_t subbuf_size
, size_t num_subbuf
,
38 unsigned int switch_timer_interval
,
39 unsigned int read_timer_interval
);
40 void (*channel_destroy
)(struct channel
*chan
);
41 struct lib_ring_buffer
*(*buffer_read_open
)(struct channel
*chan
);
42 void (*buffer_read_close
)(struct lib_ring_buffer
*buf
);
43 int (*event_reserve
)(struct lib_ring_buffer_ctx
*ctx
);
44 void (*event_commit
)(struct lib_ring_buffer_ctx
*ctx
);
45 void (*event_write
)(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
50 struct channel
*chan
; /* Channel buffers */
51 /* Event ID management */
52 struct ltt_session
*session
;
53 struct file
*file
; /* File associated to channel */
54 unsigned int free_event_id
; /* Next event ID to allocate */
55 struct list_head list
; /* Channel list */
56 wait_queue_head_t notify_wait
; /* Channel addition notif. waitqueue */
57 struct ltt_channel_ops
*ops
;
61 int active
; /* Is trace session active ? */
62 struct file
*file
; /* File associated to session */
63 struct list_head chan
; /* Channel list head */
64 struct list_head events
; /* Event list head */
65 struct list_head list
; /* Session list */
68 struct ltt_transport
{
71 struct list_head node
;
72 struct ltt_channel_ops ops
;
75 struct ltt_session
*ltt_session_create(void);
76 int ltt_session_start(struct ltt_session
*session
);
77 int ltt_session_stop(struct ltt_session
*session
);
78 void ltt_session_destroy(struct ltt_session
*session
);
80 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
81 int overwrite
, void *buf_addr
,
82 size_t subbuf_size
, size_t num_subbuf
,
83 unsigned int switch_timer_interval
,
84 unsigned int read_timer_interval
);
85 void _ltt_channel_destroy(struct ltt_channel
*chan
);
87 struct ltt_event
*ltt_event_create(struct ltt_channel
*chan
,
89 enum instrum_type itype
,
90 void *probe
, void *filter
);
91 int _ltt_event_unregister(struct ltt_event
*event
);
92 void _ltt_event_destroy(struct ltt_event
*event
);
94 void ltt_transport_register(struct ltt_transport
*transport
);
95 void ltt_transport_unregister(struct ltt_transport
*transport
);
97 int ltt_debugfs_abi_init(void);
98 void ltt_debugfs_abi_exit(void);
100 int ltt_probe_register(const char *name
, void *cb
);
101 void ltt_probe_unregister(const char *name
);
102 void *ltt_probe_get(const char *name
);
103 void ltt_probe_put(void *cb
);
104 int ltt_probes_init(void);
105 void ltt_probes_exit(void);
107 #endif /* _LTT_EVENTS_H */