Fix: consumerd: consumed size miscomputed during statistics sampling
[lttng-tools.git] / src / bin / lttng-sessiond / snapshot.hpp
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
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
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. */
cd9adb8b 55struct snapshot *snapshot_alloc();
6dc3064a
DG
56void snapshot_destroy(struct snapshot *obj);
57int snapshot_init(struct snapshot *obj);
28f23191
JG
58void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *output);
59void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *output);
6dc3064a
DG
60
61/* Snapshot output object. */
cd9adb8b 62struct snapshot_output *snapshot_output_alloc();
6dc3064a 63void snapshot_output_destroy(struct snapshot_output *obj);
b178f53e 64int snapshot_output_init(const struct ltt_session *session,
28f23191
JG
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);
b178f53e 72int snapshot_output_init_with_uri(const struct ltt_session *session,
28f23191
JG
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);
80struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot *snapshot);
81struct snapshot_output *snapshot_find_output_by_name(const char *name, struct snapshot *snapshot);
6dc3064a
DG
82
83#endif /* SNAPSHOT_H */
This page took 0.100916 seconds and 4 git commands to generate.