2 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
9 #define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
13 #include <lttng/trigger/trigger.h>
17 enum event_notifier_error_accounting_status
{
18 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK
,
19 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_ERR
,
20 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOT_FOUND
,
21 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NOMEM
,
22 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE
,
23 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD
,
27 * Initialize the event notifier error accounting system.
28 * `buffer_size_kernel` and `buffer_size_ust` represent the number of buckets
29 * to be allocated for each domain.
31 enum event_notifier_error_accounting_status
32 event_notifier_error_accounting_init(uint64_t buffer_size_kernel
,
33 uint64_t buffer_size_ust
);
36 * Register the kernel event notifier group.
37 * This allocates the counter object on the kernel side.
39 enum event_notifier_error_accounting_status
40 event_notifier_error_accounting_register_kernel(
41 int kernel_event_notifier_group_fd
);
43 #ifdef HAVE_LIBLTTNG_UST_CTL
46 * Register a UST application.
48 * This reuses (or creates) the counter object of the app UID.
50 enum event_notifier_error_accounting_status
51 event_notifier_error_accounting_register_app(struct ust_app
*app
);
54 * Unregister a UST application.
56 enum event_notifier_error_accounting_status
57 event_notifier_error_accounting_unregister_app(struct ust_app
*app
);
58 #else /* HAVE_LIBLTTNG_UST_CTL */
60 enum event_notifier_error_accounting_status
61 event_notifier_error_accounting_register_app(struct ust_app
*app
)
63 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK
;
67 enum event_notifier_error_accounting_status
68 event_notifier_error_accounting_unregister_app(struct ust_app
*app
)
70 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK
;
72 #endif /* HAVE_LIBLTTNG_UST_CTL */
75 * Allocates, reserves and returns the error counter index for that trigger.
77 enum event_notifier_error_accounting_status
78 event_notifier_error_accounting_register_event_notifier(
79 const struct lttng_trigger
*trigger
,
80 uint64_t *error_counter_index
);
82 enum event_notifier_error_accounting_status
83 event_notifier_error_accounting_get_count(
84 const struct lttng_trigger
*trigger
,
87 void event_notifier_error_accounting_unregister_event_notifier(
88 const struct lttng_trigger
*trigger
);
90 void event_notifier_error_accounting_fini(void);
92 #endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */