Commit | Line | Data |
---|---|---|
331744e3 | 1 | /* |
ab5be9fa MJ |
2 | * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com> |
3 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> | |
331744e3 | 4 | * |
ab5be9fa | 5 | * SPDX-License-Identifier: GPL-2.0-only |
331744e3 | 6 | * |
331744e3 JD |
7 | */ |
8 | ||
9 | #ifndef CONSUMER_METADATA_CACHE_H | |
10 | #define CONSUMER_METADATA_CACHE_H | |
11 | ||
c8fea79c | 12 | #include <common/consumer/consumer.h> |
331744e3 JD |
13 | |
14 | struct consumer_metadata_cache { | |
15 | char *data; | |
16 | uint64_t cache_alloc_size; | |
93ec662e JD |
17 | /* |
18 | * Current version of the metadata cache. | |
19 | */ | |
20 | uint64_t version; | |
331744e3 JD |
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. | |
c585821b | 26 | * All cached data is contiguous. |
331744e3 JD |
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). | |
73811ecc DG |
32 | * |
33 | * This is nested INSIDE the consumer_data lock. | |
331744e3 JD |
34 | */ |
35 | pthread_mutex_t lock; | |
36 | }; | |
37 | ||
38 | int consumer_metadata_cache_write(struct lttng_consumer_channel *channel, | |
93ec662e JD |
39 | unsigned int offset, unsigned int len, uint64_t version, |
40 | char *data); | |
331744e3 JD |
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, | |
5e41ebe1 | 44 | uint64_t offset, int timer); |
5b8eb761 | 45 | int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel); |
331744e3 JD |
46 | |
47 | #endif /* CONSUMER_METADATA_CACHE_H */ |