-
Notifications
You must be signed in to change notification settings - Fork 76
/
consumer-timer.hpp
56 lines (46 loc) · 1.88 KB
/
consumer-timer.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Copyright (C) 2011 EfficiOS Inc.
* Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
*
* SPDX-License-Identifier: GPL-2.0-only
*
*/
#ifndef CONSUMER_TIMER_H
#define CONSUMER_TIMER_H
#include "consumer.hpp"
#include <pthread.h>
#define LTTNG_CONSUMER_SIG_SWITCH ((SIGRTMIN + 10))
#define LTTNG_CONSUMER_SIG_TEARDOWN ((SIGRTMIN + 11))
#define LTTNG_CONSUMER_SIG_LIVE ((SIGRTMIN + 12))
#define LTTNG_CONSUMER_SIG_MONITOR ((SIGRTMIN + 13))
#define LTTNG_CONSUMER_SIG_EXIT ((SIGRTMIN + 14))
#define CLOCKID CLOCK_MONOTONIC
/*
* Handle timer teardown race wrt memory free of private data by consumer
* signals are handled by a single thread, which permits a synchronization
* point between handling of each signal. Internal lock ensures mutual
* exclusion.
*/
struct timer_signal_data {
pthread_t tid; /* thread id managing signals */
int setup_done;
int qs_done;
pthread_mutex_t lock;
};
void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
unsigned int switch_timer_interval_us);
void consumer_timer_switch_stop(struct lttng_consumer_channel *channel);
void consumer_timer_live_start(struct lttng_consumer_channel *channel,
unsigned int live_timer_interval_us);
void consumer_timer_live_stop(struct lttng_consumer_channel *channel);
int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
unsigned int monitor_timer_interval_us);
int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel);
void *consumer_timer_thread(void *data);
int consumer_signal_init();
int consumer_flush_kernel_index(struct lttng_consumer_stream *stream);
int consumer_flush_ust_index(struct lttng_consumer_stream *stream);
int consumer_timer_thread_get_channel_monitor_pipe();
int consumer_timer_thread_set_channel_monitor_pipe(int fd);
#endif /* CONSUMER_TIMER_H */