Commit | Line | Data |
---|---|---|
6dc3064a | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> |
6dc3064a | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
6dc3064a | 5 | * |
6dc3064a DG |
6 | */ |
7 | ||
8 | #ifndef SNAPSHOT_H | |
9 | #define SNAPSHOT_H | |
10 | ||
28f23191 | 11 | #include "consumer.hpp" |
6dc3064a | 12 | |
c9e313bc SM |
13 | #include <common/common.hpp> |
14 | #include <common/hashtable/hashtable.hpp> | |
15 | #include <common/uri.hpp> | |
6dc3064a | 16 | |
28f23191 JG |
17 | #include <limits.h> |
18 | #include <stdint.h> | |
6dc3064a DG |
19 | |
20 | struct consumer_output; | |
21 | ||
22 | struct snapshot_output { | |
23 | uint32_t id; | |
24 | uint64_t max_size; | |
1bfe7328 DG |
25 | /* Number of snapshot taken with that output. */ |
26 | uint64_t nb_snapshot; | |
6dc3064a DG |
27 | char name[NAME_MAX]; |
28 | struct consumer_output *consumer; | |
29 | int kernel_sockets_copied; | |
30 | int ust_sockets_copied; | |
10a50311 JD |
31 | /* |
32 | * Contains the string with "<date>-<time>" for when the snapshot command | |
33 | * is triggered. This is to make sure every streams will use the same time | |
34 | * for the directory output. | |
35 | */ | |
36 | char datetime[16]; | |
6dc3064a DG |
37 | |
38 | /* Indexed by ID. */ | |
39 | struct lttng_ht_node_ulong node; | |
40 | }; | |
41 | ||
42 | struct snapshot { | |
43 | unsigned long next_output_id; | |
44 | size_t nb_output; | |
1bfe7328 DG |
45 | /* |
46 | * Number of snapshot taken for that object. This value is used with a | |
47 | * temporary output of a snapshot record. | |
48 | */ | |
49 | uint64_t nb_snapshot; | |
6dc3064a DG |
50 | struct lttng_ht *output_ht; |
51 | }; | |
52 | ||
53 | /* Snapshot object. */ | |
cd9adb8b | 54 | struct snapshot *snapshot_alloc(); |
6dc3064a DG |
55 | void snapshot_destroy(struct snapshot *obj); |
56 | int snapshot_init(struct snapshot *obj); | |
28f23191 JG |
57 | void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output); |
58 | void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output); | |
6dc3064a DG |
59 | |
60 | /* Snapshot output object. */ | |
cd9adb8b | 61 | struct snapshot_output *snapshot_output_alloc(); |
6dc3064a | 62 | void snapshot_output_destroy(struct snapshot_output *obj); |
a0a4f314 | 63 | |
28f23191 JG |
64 | struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot); |
65 | struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot); | |
6dc3064a DG |
66 | |
67 | #endif /* SNAPSHOT_H */ |