Add kernel and UST time namespace context
[lttng-tools.git] / src / bin / lttng-sessiond / snapshot.h
CommitLineData
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
11#include <limits.h>
12#include <stdint.h>
13
14#include <common/common.h>
15#include <common/hashtable/hashtable.h>
16#include <common/uri.h>
17
18#include "consumer.h"
19
20struct consumer_output;
b178f53e 21struct ltt_session;
6dc3064a
DG
22
23struct snapshot_output {
24 uint32_t id;
25 uint64_t max_size;
1bfe7328
DG
26 /* Number of snapshot taken with that output. */
27 uint64_t nb_snapshot;
6dc3064a
DG
28 char name[NAME_MAX];
29 struct consumer_output *consumer;
30 int kernel_sockets_copied;
31 int ust_sockets_copied;
10a50311
JD
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];
6dc3064a
DG
38
39 /* Indexed by ID. */
40 struct lttng_ht_node_ulong node;
41};
42
43struct snapshot {
44 unsigned long next_output_id;
45 size_t nb_output;
1bfe7328
DG
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;
6dc3064a
DG
51 struct lttng_ht *output_ht;
52};
53
54/* Snapshot object. */
55struct snapshot *snapshot_alloc(void);
56void snapshot_destroy(struct snapshot *obj);
57int snapshot_init(struct snapshot *obj);
58void snapshot_delete_output(struct snapshot *snapshot,
59 struct snapshot_output *output);
60void snapshot_add_output(struct snapshot *snapshot,
61 struct snapshot_output *output);
62
63/* Snapshot output object. */
64struct snapshot_output *snapshot_output_alloc(void);
65void snapshot_output_destroy(struct snapshot_output *obj);
b178f53e
JG
66int snapshot_output_init(const struct ltt_session *session,
67 uint64_t max_size, const char *name,
6dc3064a
DG
68 const char *ctrl_url, const char *data_url,
69 struct consumer_output *consumer, struct snapshot_output *output,
70 struct snapshot *snapshot);
b178f53e
JG
71int snapshot_output_init_with_uri(const struct ltt_session *session,
72 uint64_t max_size, const char *name,
27babd3a
DG
73 struct lttng_uri *uris, size_t nb_uri,
74 struct consumer_output *consumer, struct snapshot_output *output,
75 struct snapshot *snapshot);
6dc3064a
DG
76struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
77 struct snapshot *snapshot);
eb240553
DG
78struct snapshot_output *snapshot_find_output_by_name(const char *name,
79 struct snapshot *snapshot);
6dc3064a
DG
80
81#endif /* SNAPSHOT_H */
This page took 0.051197 seconds and 4 git commands to generate.