rotate timer ready, need UI/API
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / sessiond-timer.h
1 /*
2 * Copyright (C) 2017 - Julien Desfossez <jdesfossez@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as 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
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef SESSIOND_TIMER_H
19 #define SESSIOND_TIMER_H
20
21 #include <pthread.h>
22
23 #include "session.h"
24
25 #define LTTNG_SESSIOND_SIG_TEARDOWN SIGRTMIN + 10
26 #define LTTNG_SESSIOND_SIG_EXIT SIGRTMIN + 11
27 #define LTTNG_SESSIOND_SIG_ROTATE_PENDING SIGRTMIN + 12
28 #define LTTNG_SESSIOND_SIG_ROTATE_TIMER SIGRTMIN + 13
29
30 #define CLOCKID CLOCK_MONOTONIC
31
32 /*
33 * Handle timer teardown race wrt memory free of private data by sessiond
34 * signals are handled by a single thread, which permits a synchronization
35 * point between handling of each signal. Internal lock ensures mutual
36 * exclusion.
37 */
38 struct timer_signal_data {
39 pthread_t tid; /* thread id managing signals */
40 int setup_done;
41 int qs_done;
42 pthread_mutex_t lock;
43 };
44
45 struct timer_thread_parameters {
46 int rotate_timer_pipe;
47 };
48
49 struct sessiond_rotation_timer {
50 uint64_t session_id;
51 unsigned int signal;
52 } LTTNG_PACKED;
53
54 void *sessiond_timer_thread(void *data);
55 int sessiond_timer_signal_init(void);
56
57 int sessiond_timer_rotate_pending_start(struct ltt_session *session, unsigned int
58 interval_us);
59 void sessiond_timer_rotate_pending_stop(struct ltt_session *session);
60
61 int sessiond_rotate_timer_start(struct ltt_session *session,
62 unsigned int interval_us);
63
64 void sessiond_rotate_timer_stop(struct ltt_session *session);
65
66 #endif /* SESSIOND_TIMER_H */
This page took 0.033505 seconds and 6 git commands to generate.