Commit | Line | Data |
---|---|---|
331744e3 | 1 | /* |
ab5be9fa MJ |
2 | * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca> |
3 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | * Copyright (C) 2012 David Goulet <dgoulet@efficios.com> | |
331744e3 | 5 | * |
ab5be9fa | 6 | * SPDX-License-Identifier: GPL-2.0-only |
331744e3 | 7 | * |
331744e3 JD |
8 | */ |
9 | ||
10 | #ifndef CONSUMER_TIMER_H | |
11 | #define CONSUMER_TIMER_H | |
12 | ||
13 | #include <pthread.h> | |
14 | ||
15 | #include "consumer.h" | |
16 | ||
17 | #define LTTNG_CONSUMER_SIG_SWITCH SIGRTMIN + 10 | |
18 | #define LTTNG_CONSUMER_SIG_TEARDOWN SIGRTMIN + 11 | |
d3e2ba59 | 19 | #define LTTNG_CONSUMER_SIG_LIVE SIGRTMIN + 12 |
e9404c27 | 20 | #define LTTNG_CONSUMER_SIG_MONITOR SIGRTMIN + 13 |
13675d0e | 21 | #define LTTNG_CONSUMER_SIG_EXIT SIGRTMIN + 14 |
331744e3 JD |
22 | |
23 | #define CLOCKID CLOCK_MONOTONIC | |
24 | ||
25 | /* | |
26 | * Handle timer teardown race wrt memory free of private data by consumer | |
27 | * signals are handled by a single thread, which permits a synchronization | |
2b8f8754 MD |
28 | * point between handling of each signal. Internal lock ensures mutual |
29 | * exclusion. | |
331744e3 JD |
30 | */ |
31 | struct timer_signal_data { | |
32 | pthread_t tid; /* thread id managing signals */ | |
33 | int setup_done; | |
34 | int qs_done; | |
2b8f8754 | 35 | pthread_mutex_t lock; |
331744e3 JD |
36 | }; |
37 | ||
38 | void consumer_timer_switch_start(struct lttng_consumer_channel *channel, | |
e9404c27 | 39 | unsigned int switch_timer_interval_us); |
331744e3 | 40 | void consumer_timer_switch_stop(struct lttng_consumer_channel *channel); |
d3e2ba59 | 41 | void consumer_timer_live_start(struct lttng_consumer_channel *channel, |
e9404c27 | 42 | unsigned int live_timer_interval_us); |
d3e2ba59 | 43 | void consumer_timer_live_stop(struct lttng_consumer_channel *channel); |
e9404c27 JG |
44 | int consumer_timer_monitor_start(struct lttng_consumer_channel *channel, |
45 | unsigned int monitor_timer_interval_us); | |
46 | int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel); | |
d3e2ba59 | 47 | void *consumer_timer_thread(void *data); |
73664f81 | 48 | int consumer_signal_init(void); |
331744e3 | 49 | |
c585821b MD |
50 | int consumer_flush_kernel_index(struct lttng_consumer_stream *stream); |
51 | int consumer_flush_ust_index(struct lttng_consumer_stream *stream); | |
52 | ||
e9404c27 JG |
53 | int consumer_timer_thread_get_channel_monitor_pipe(void); |
54 | int consumer_timer_thread_set_channel_monitor_pipe(int fd); | |
55 | ||
331744e3 | 56 | #endif /* CONSUMER_TIMER_H */ |