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