Fix: keep ust/kernel session items around for destroy notifier
[lttng-tools.git] / src / bin / lttng-sessiond / snapshot.h
CommitLineData
6dc3064a
DG
1/*
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#ifndef SNAPSHOT_H
19#define SNAPSHOT_H
20
21#include <limits.h>
22#include <stdint.h>
23
24#include <common/common.h>
25#include <common/hashtable/hashtable.h>
26#include <common/uri.h>
27
28#include "consumer.h"
29
30struct consumer_output;
b178f53e 31struct ltt_session;
6dc3064a
DG
32
33struct snapshot_output {
34 uint32_t id;
35 uint64_t max_size;
1bfe7328
DG
36 /* Number of snapshot taken with that output. */
37 uint64_t nb_snapshot;
6dc3064a
DG
38 char name[NAME_MAX];
39 struct consumer_output *consumer;
40 int kernel_sockets_copied;
41 int ust_sockets_copied;
10a50311
JD
42 /*
43 * Contains the string with "<date>-<time>" for when the snapshot command
44 * is triggered. This is to make sure every streams will use the same time
45 * for the directory output.
46 */
47 char datetime[16];
6dc3064a
DG
48
49 /* Indexed by ID. */
50 struct lttng_ht_node_ulong node;
51};
52
53struct snapshot {
54 unsigned long next_output_id;
55 size_t nb_output;
1bfe7328
DG
56 /*
57 * Number of snapshot taken for that object. This value is used with a
58 * temporary output of a snapshot record.
59 */
60 uint64_t nb_snapshot;
6dc3064a
DG
61 struct lttng_ht *output_ht;
62};
63
64/* Snapshot object. */
65struct snapshot *snapshot_alloc(void);
66void snapshot_destroy(struct snapshot *obj);
67int snapshot_init(struct snapshot *obj);
68void snapshot_delete_output(struct snapshot *snapshot,
69 struct snapshot_output *output);
70void snapshot_add_output(struct snapshot *snapshot,
71 struct snapshot_output *output);
72
73/* Snapshot output object. */
74struct snapshot_output *snapshot_output_alloc(void);
75void snapshot_output_destroy(struct snapshot_output *obj);
b178f53e
JG
76int snapshot_output_init(const struct ltt_session *session,
77 uint64_t max_size, const char *name,
6dc3064a
DG
78 const char *ctrl_url, const char *data_url,
79 struct consumer_output *consumer, struct snapshot_output *output,
80 struct snapshot *snapshot);
b178f53e
JG
81int snapshot_output_init_with_uri(const struct ltt_session *session,
82 uint64_t max_size, const char *name,
27babd3a
DG
83 struct lttng_uri *uris, size_t nb_uri,
84 struct consumer_output *consumer, struct snapshot_output *output,
85 struct snapshot *snapshot);
6dc3064a
DG
86struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
87 struct snapshot *snapshot);
eb240553
DG
88struct snapshot_output *snapshot_find_output_by_name(const char *name,
89 struct snapshot *snapshot);
6dc3064a
DG
90
91#endif /* SNAPSHOT_H */
This page took 0.051928 seconds and 4 git commands to generate.