Commit | Line | Data |
---|---|---|
331744e3 JD |
1 | /* |
2 | * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com> | |
3 | * David Goulet <dgoulet@efficios.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License, version 2 only, | |
7 | * as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along | |
15 | * with this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | */ | |
18 | ||
19 | #ifndef CONSUMER_METADATA_CACHE_H | |
20 | #define CONSUMER_METADATA_CACHE_H | |
21 | ||
c8fea79c | 22 | #include <common/consumer/consumer.h> |
331744e3 JD |
23 | |
24 | struct consumer_metadata_cache { | |
25 | char *data; | |
26 | uint64_t cache_alloc_size; | |
93ec662e JD |
27 | /* |
28 | * Current version of the metadata cache. | |
29 | */ | |
30 | uint64_t version; | |
331744e3 JD |
31 | /* |
32 | * The upper-limit of data written inside the buffer. | |
33 | * | |
34 | * With the total_bytes_written it allows us to keep track of when the | |
35 | * cache contains contiguous metadata ready to be sent to the RB. | |
c585821b | 36 | * All cached data is contiguous. |
331744e3 JD |
37 | */ |
38 | uint64_t max_offset; | |
39 | /* | |
40 | * Lock to update the metadata cache and push into the ring_buffer | |
41 | * (ustctl_write_metadata_to_channel). | |
73811ecc DG |
42 | * |
43 | * This is nested INSIDE the consumer_data lock. | |
331744e3 JD |
44 | */ |
45 | pthread_mutex_t lock; | |
46 | }; | |
47 | ||
48 | int consumer_metadata_cache_write(struct lttng_consumer_channel *channel, | |
93ec662e JD |
49 | unsigned int offset, unsigned int len, uint64_t version, |
50 | char *data); | |
331744e3 JD |
51 | int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel); |
52 | void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel); | |
53 | int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel, | |
5e41ebe1 | 54 | uint64_t offset, int timer); |
5b8eb761 | 55 | int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel); |
331744e3 JD |
56 | |
57 | #endif /* CONSUMER_METADATA_CACHE_H */ |