fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / src / bin / lttng-sessiond / snapshot.hpp
1 /*
2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef SNAPSHOT_H
9 #define SNAPSHOT_H
10
11 #include "consumer.hpp"
12
13 #include <common/common.hpp>
14 #include <common/hashtable/hashtable.hpp>
15 #include <common/uri.hpp>
16
17 #include <limits.h>
18 #include <stdint.h>
19
20 struct consumer_output;
21 struct ltt_session;
22
23 struct snapshot_output {
24 uint32_t id;
25 uint64_t max_size;
26 /* Number of snapshot taken with that output. */
27 uint64_t nb_snapshot;
28 char name[NAME_MAX];
29 struct consumer_output *consumer;
30 int kernel_sockets_copied;
31 int ust_sockets_copied;
32 /*
33 * Contains the string with "<date>-<time>" for when the snapshot command
34 * is triggered. This is to make sure every streams will use the same time
35 * for the directory output.
36 */
37 char datetime[16];
38
39 /* Indexed by ID. */
40 struct lttng_ht_node_ulong node;
41 };
42
43 struct snapshot {
44 unsigned long next_output_id;
45 size_t nb_output;
46 /*
47 * Number of snapshot taken for that object. This value is used with a
48 * temporary output of a snapshot record.
49 */
50 uint64_t nb_snapshot;
51 struct lttng_ht *output_ht;
52 };
53
54 /* Snapshot object. */
55 struct snapshot *snapshot_alloc();
56 void snapshot_destroy(struct snapshot *obj);
57 int snapshot_init(struct snapshot *obj);
58 void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output);
59 void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output);
60
61 /* Snapshot output object. */
62 struct snapshot_output *snapshot_output_alloc();
63 void snapshot_output_destroy(struct snapshot_output *obj);
64 int snapshot_output_init(const struct ltt_session *session,
65 uint64_t max_size,
66 const char *name,
67 const char *ctrl_url,
68 const char *data_url,
69 struct consumer_output *consumer,
70 struct snapshot_output *output,
71 struct snapshot *snapshot);
72 int snapshot_output_init_with_uri(const struct ltt_session *session,
73 uint64_t max_size,
74 const char *name,
75 struct lttng_uri *uris,
76 size_t nb_uri,
77 struct consumer_output *consumer,
78 struct snapshot_output *output,
79 struct snapshot *snapshot);
80 struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot);
81 struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot);
82
83 #endif /* SNAPSHOT_H */
This page took 0.031754 seconds and 4 git commands to generate.