Fix: missing include can cause structures to not be packed
[lttng-tools.git] / include / lttng / condition / buffer-usage-internal.h
CommitLineData
a58c490f
JG
1/*
2 * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library 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 Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18#ifndef LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H
19#define LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H
20
21#include <lttng/condition/buffer-usage.h>
22#include <lttng/condition/condition-internal.h>
23#include <lttng/condition/evaluation-internal.h>
24#include <lttng/domain.h>
25#include "common/buffer-view.h"
aa52c986 26#include <common/macros.h>
a58c490f
JG
27
28struct lttng_condition_buffer_usage {
29 struct lttng_condition parent;
30 struct {
31 bool set;
32 uint64_t value;
33 } threshold_bytes;
34 struct {
35 bool set;
36 double value;
37 } threshold_ratio;
38 char *session_name;
39 char *channel_name;
40 struct {
41 bool set;
42 enum lttng_domain_type type;
43 } domain;
44};
45
46struct lttng_condition_buffer_usage_comm {
47 uint8_t threshold_set_in_bytes;
48 /*
49 * Expressed in bytes if "threshold_set_in_bytes" is not 0.
50 * Otherwise, it is expressed a ratio in the interval [0.0, 1.0]
51 * that is mapped to the range on a 32-bit unsigned integer.
52 * The ratio is obtained by (threshold / UINT32_MAX).
53 */
54 uint32_t threshold;
55 /* Both lengths include the trailing \0. */
56 uint32_t session_name_len;
57 uint32_t channel_name_len;
58 /* enum lttng_domain_type */
59 int8_t domain_type;
60 /* session and channel names. */
61 char names[];
62} LTTNG_PACKED;
63
64struct lttng_evaluation_buffer_usage {
65 struct lttng_evaluation parent;
66 uint64_t buffer_use;
67 uint64_t buffer_capacity;
68};
69
70struct lttng_evaluation_buffer_usage_comm {
71 uint64_t buffer_use;
72 uint64_t buffer_capacity;
73} LTTNG_PACKED;
74
75LTTNG_HIDDEN
76struct lttng_evaluation *lttng_evaluation_buffer_usage_create(
77 enum lttng_condition_type type, uint64_t use,
78 uint64_t capacity);
79
80LTTNG_HIDDEN
81ssize_t lttng_condition_buffer_usage_low_create_from_buffer(
82 const struct lttng_buffer_view *view,
83 struct lttng_condition **condition);
84
85LTTNG_HIDDEN
86ssize_t lttng_condition_buffer_usage_high_create_from_buffer(
87 const struct lttng_buffer_view *view,
88 struct lttng_condition **condition);
89
90LTTNG_HIDDEN
91ssize_t lttng_evaluation_buffer_usage_low_create_from_buffer(
92 const struct lttng_buffer_view *view,
93 struct lttng_evaluation **evaluation);
94
95LTTNG_HIDDEN
96ssize_t lttng_evaluation_buffer_usage_high_create_from_buffer(
97 const struct lttng_buffer_view *view,
98 struct lttng_evaluation **evaluation);
99
100#endif /* LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H */
This page took 0.028227 seconds and 4 git commands to generate.