a442dcaf25fe72f1a9fa08d4bf85bca145d95030
[lttng-tools.git] / src / common / consumer / consumer-metadata-cache.h
1 /*
2 * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 #ifndef CONSUMER_METADATA_CACHE_H
10 #define CONSUMER_METADATA_CACHE_H
11
12 #include <common/consumer/consumer.h>
13
14 struct consumer_metadata_cache {
15 char *data;
16 uint64_t cache_alloc_size;
17 /*
18 * Current version of the metadata cache.
19 */
20 uint64_t version;
21 /*
22 * The upper-limit of data written inside the buffer.
23 *
24 * With the total_bytes_written it allows us to keep track of when the
25 * cache contains contiguous metadata ready to be sent to the RB.
26 * All cached data is contiguous.
27 */
28 uint64_t max_offset;
29 /*
30 * Lock to update the metadata cache and push into the ring_buffer
31 * (ustctl_write_metadata_to_channel).
32 *
33 * This is nested INSIDE the consumer_data lock.
34 */
35 pthread_mutex_t lock;
36 };
37
38 int consumer_metadata_cache_write(struct lttng_consumer_channel *channel,
39 unsigned int offset, unsigned int len, uint64_t version,
40 char *data);
41 int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel);
42 void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel);
43 int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
44 uint64_t offset, int timer);
45 int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel);
46
47 #endif /* CONSUMER_METADATA_CACHE_H */
This page took 0.039491 seconds and 3 git commands to generate.