Commit | Line | Data |
---|---|---|
6e0be6cc JD |
1 | /* |
2 | * Copyright (C) 2017 - Julien Desfossez <jdesfossez@efficios.com> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU General Public License, version 2 only, as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
11 | * more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License along with | |
14 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
15 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
16 | */ | |
17 | ||
18 | #ifndef ROTATION_THREAD_H | |
19 | #define ROTATION_THREAD_H | |
20 | ||
21 | #include <urcu/list.h> | |
22 | #include <urcu.h> | |
23 | #include <urcu/rculfhash.h> | |
24 | #include <lttng/domain.h> | |
25 | #include <common/pipe.h> | |
26 | #include <common/compat/poll.h> | |
27 | #include <common/hashtable/hashtable.h> | |
28 | #include <pthread.h> | |
69cda452 | 29 | #include "session.h" |
6e0be6cc | 30 | |
6e0be6cc JD |
31 | struct rotation_channel_key { |
32 | uint64_t key; | |
33 | enum lttng_domain_type domain; | |
34 | }; | |
35 | ||
36 | struct rotation_channel_info { | |
69cda452 | 37 | uint64_t session_id; |
6e0be6cc JD |
38 | struct rotation_channel_key channel_key; |
39 | struct cds_lfht_node rotate_channels_ht_node; | |
40 | }; | |
41 | ||
42 | struct rotation_thread_handle { | |
43 | /* | |
44 | * Read side of pipes used to receive channel status info collected | |
45 | * by the various consumer daemons. | |
46 | */ | |
47 | int ust32_consumer; | |
48 | int ust64_consumer; | |
49 | int kernel_consumer; | |
50 | int thread_quit_pipe; | |
55c2a7f9 | 51 | int rotate_timer_pipe; |
6e0be6cc JD |
52 | }; |
53 | ||
54 | struct rotation_thread_state { | |
55 | struct lttng_poll_event events; | |
56 | }; | |
57 | ||
58 | /* rotation_thread_data takes ownership of the channel rotate pipes. */ | |
59 | struct rotation_thread_handle *rotation_thread_handle_create( | |
60 | struct lttng_pipe *ust32_channel_rotate_pipe, | |
61 | struct lttng_pipe *ust64_channel_rotate_pipe, | |
62 | struct lttng_pipe *kernel_channel_rotate_pipe, | |
55c2a7f9 | 63 | int thread_quit_pipe, int rotate_timer_pipe); |
6e0be6cc JD |
64 | |
65 | void rotation_thread_handle_destroy( | |
66 | struct rotation_thread_handle *handle); | |
67 | ||
68 | void rotation_thread_quit(struct rotation_thread_handle *handle); | |
69 | ||
70 | int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain, | |
71 | struct ltt_session *session); | |
6e0be6cc JD |
72 | |
73 | void *thread_rotation(void *data); | |
74 | ||
6e0be6cc | 75 | #endif /* ROTATION_THREAD_H */ |