Rename firing policy to rate policy
[lttng-tools.git] / include / lttng / action / action-internal.h
... / ...
CommitLineData
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_ACTION_INTERNAL_H
9#define LTTNG_ACTION_INTERNAL_H
10
11#include <lttng/action/action.h>
12#include <common/macros.h>
13#include <common/buffer-view.h>
14#include <common/dynamic-buffer.h>
15#include <common/payload-view.h>
16#include <common/payload.h>
17#include <stdbool.h>
18#include <sys/types.h>
19#include <urcu/ref.h>
20
21struct lttng_rate_policy;
22
23typedef bool (*action_validate_cb)(struct lttng_action *action);
24typedef void (*action_destroy_cb)(struct lttng_action *action);
25typedef int (*action_serialize_cb)(struct lttng_action *action,
26 struct lttng_payload *payload);
27typedef bool (*action_equal_cb)(const struct lttng_action *a,
28 const struct lttng_action *b);
29typedef ssize_t (*action_create_from_payload_cb)(
30 struct lttng_payload_view *view,
31 struct lttng_action **action);
32typedef const struct lttng_rate_policy *(*action_get_rate_policy_cb)(
33 const struct lttng_action *action);
34
35struct lttng_action {
36 struct urcu_ref ref;
37 enum lttng_action_type type;
38 action_validate_cb validate;
39 action_serialize_cb serialize;
40 action_equal_cb equal;
41 action_destroy_cb destroy;
42 action_get_rate_policy_cb get_rate_policy;
43
44 /* Internal use only. */
45
46 /* The number of time the actions was enqueued for execution. */
47 uint64_t execution_request_counter;
48 /*
49 * The number of time the action was actually executed.
50 * Action rate policy can impact on this number.
51 * */
52 uint64_t execution_counter;
53 /*
54 * The number of time the action execution failed.
55 */
56 uint64_t execution_failure_counter;
57};
58
59struct lttng_action_comm {
60 /* enum lttng_action_type */
61 int8_t action_type;
62} LTTNG_PACKED;
63
64LTTNG_HIDDEN
65void lttng_action_init(struct lttng_action *action,
66 enum lttng_action_type type,
67 action_validate_cb validate,
68 action_serialize_cb serialize,
69 action_equal_cb equal,
70 action_destroy_cb destroy,
71 action_get_rate_policy_cb get_rate_policy);
72
73LTTNG_HIDDEN
74bool lttng_action_validate(struct lttng_action *action);
75
76LTTNG_HIDDEN
77int lttng_action_serialize(struct lttng_action *action,
78 struct lttng_payload *buf);
79
80LTTNG_HIDDEN
81ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
82 struct lttng_action **action);
83
84LTTNG_HIDDEN
85bool lttng_action_is_equal(const struct lttng_action *a,
86 const struct lttng_action *b);
87
88LTTNG_HIDDEN
89void lttng_action_get(struct lttng_action *action);
90
91LTTNG_HIDDEN
92void lttng_action_put(struct lttng_action *action);
93
94LTTNG_HIDDEN
95const char* lttng_action_type_string(enum lttng_action_type action_type);
96
97LTTNG_HIDDEN
98void lttng_action_increase_execution_request_count(struct lttng_action *action);
99
100LTTNG_HIDDEN
101void lttng_action_increase_execution_count(struct lttng_action *action);
102
103LTTNG_HIDDEN
104void lttng_action_increase_execution_failure_count(struct lttng_action *action);
105
106LTTNG_HIDDEN
107bool lttng_action_should_execute(const struct lttng_action *action);
108
109#endif /* LTTNG_ACTION_INTERNAL_H */
This page took 0.022964 seconds and 4 git commands to generate.