Commit | Line | Data |
---|---|---|
a58c490f | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
a58c490f | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
a58c490f | 5 | * |
a58c490f JG |
6 | */ |
7 | ||
8 | #ifndef LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H | |
9 | #define LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H | |
10 | ||
11 | #include <lttng/condition/buffer-usage.h> | |
12 | #include <lttng/condition/condition-internal.h> | |
13 | #include <lttng/condition/evaluation-internal.h> | |
14 | #include <lttng/domain.h> | |
15 | #include "common/buffer-view.h" | |
aa52c986 | 16 | #include <common/macros.h> |
a58c490f | 17 | |
7966af57 SM |
18 | #ifdef __cplusplus |
19 | extern "C" { | |
20 | #endif | |
21 | ||
a58c490f JG |
22 | struct lttng_condition_buffer_usage { |
23 | struct lttng_condition parent; | |
24 | struct { | |
25 | bool set; | |
26 | uint64_t value; | |
27 | } threshold_bytes; | |
28 | struct { | |
29 | bool set; | |
30 | double value; | |
31 | } threshold_ratio; | |
32 | char *session_name; | |
33 | char *channel_name; | |
34 | struct { | |
35 | bool set; | |
36 | enum lttng_domain_type type; | |
37 | } domain; | |
38 | }; | |
39 | ||
40 | struct lttng_condition_buffer_usage_comm { | |
41 | uint8_t threshold_set_in_bytes; | |
f66473ac FD |
42 | uint64_t threshold_bytes; |
43 | double threshold_ratio; | |
a58c490f JG |
44 | /* Both lengths include the trailing \0. */ |
45 | uint32_t session_name_len; | |
46 | uint32_t channel_name_len; | |
47 | /* enum lttng_domain_type */ | |
48 | int8_t domain_type; | |
49 | /* session and channel names. */ | |
50 | char names[]; | |
51 | } LTTNG_PACKED; | |
52 | ||
53 | struct lttng_evaluation_buffer_usage { | |
54 | struct lttng_evaluation parent; | |
55 | uint64_t buffer_use; | |
56 | uint64_t buffer_capacity; | |
57 | }; | |
58 | ||
59 | struct lttng_evaluation_buffer_usage_comm { | |
60 | uint64_t buffer_use; | |
61 | uint64_t buffer_capacity; | |
62 | } LTTNG_PACKED; | |
63 | ||
a58c490f JG |
64 | struct lttng_evaluation *lttng_evaluation_buffer_usage_create( |
65 | enum lttng_condition_type type, uint64_t use, | |
66 | uint64_t capacity); | |
67 | ||
c0a66c84 JG |
68 | ssize_t lttng_condition_buffer_usage_low_create_from_payload( |
69 | struct lttng_payload_view *view, | |
a58c490f JG |
70 | struct lttng_condition **condition); |
71 | ||
c0a66c84 JG |
72 | ssize_t lttng_condition_buffer_usage_high_create_from_payload( |
73 | struct lttng_payload_view *view, | |
a58c490f JG |
74 | struct lttng_condition **condition); |
75 | ||
c0a66c84 JG |
76 | ssize_t lttng_evaluation_buffer_usage_low_create_from_payload( |
77 | struct lttng_payload_view *view, | |
a58c490f JG |
78 | struct lttng_evaluation **evaluation); |
79 | ||
c0a66c84 JG |
80 | ssize_t lttng_evaluation_buffer_usage_high_create_from_payload( |
81 | struct lttng_payload_view *view, | |
a58c490f JG |
82 | struct lttng_evaluation **evaluation); |
83 | ||
7966af57 SM |
84 | #ifdef __cplusplus |
85 | } | |
86 | #endif | |
87 | ||
a58c490f | 88 | #endif /* LTTNG_CONDITION_BUFFER_USAGE_INTERNAL_H */ |