Rename C++ header files to .hpp
[lttng-tools.git] / src / bin / lttng-sessiond / event-notifier-error-accounting.hpp
CommitLineData
90aa04a1
FD
1/*
2 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
9#define _EVENT_NOTIFIER_ERROR_ACCOUNTING_H
10
11#include <stdint.h>
533a90fb 12
90aa04a1
FD
13#include <lttng/trigger/trigger.h>
14
c9e313bc 15#include "ust-app.hpp"
533a90fb 16
90aa04a1
FD
17enum 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,
533a90fb 23 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD,
783db316 24 EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED,
90aa04a1
FD
25};
26
761ffce2
FD
27/*
28 * Initialize the event notifier error accounting system.
29 * `buffer_size_kernel` and `buffer_size_ust` represent the number of buckets
30 * to be allocated for each domain.
31 */
90aa04a1 32enum event_notifier_error_accounting_status
761ffce2
FD
33event_notifier_error_accounting_init(uint64_t buffer_size_kernel,
34 uint64_t buffer_size_ust);
90aa04a1 35
761ffce2
FD
36/*
37 * Register the kernel event notifier group.
38 * This allocates the counter object on the kernel side.
39 */
90aa04a1
FD
40enum event_notifier_error_accounting_status
41event_notifier_error_accounting_register_kernel(
42 int kernel_event_notifier_group_fd);
43
533a90fb 44#ifdef HAVE_LIBLTTNG_UST_CTL
761ffce2
FD
45
46/*
47 * Register a UST application.
48 *
49 * This reuses (or creates) the counter object of the app UID.
50 */
533a90fb
FD
51enum event_notifier_error_accounting_status
52event_notifier_error_accounting_register_app(struct ust_app *app);
53
761ffce2
FD
54/*
55 * Unregister a UST application.
56 */
533a90fb
FD
57enum event_notifier_error_accounting_status
58event_notifier_error_accounting_unregister_app(struct ust_app *app);
f46376a1 59
533a90fb 60#else /* HAVE_LIBLTTNG_UST_CTL */
f46376a1 61
533a90fb
FD
62static inline
63enum event_notifier_error_accounting_status
f46376a1
MJ
64event_notifier_error_accounting_register_app(
65 struct ust_app *app __attribute__((unused)))
533a90fb
FD
66{
67 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
68}
69
70static inline
71enum event_notifier_error_accounting_status
f46376a1
MJ
72event_notifier_error_accounting_unregister_app(
73 struct ust_app *app __attribute__((unused)))
533a90fb
FD
74{
75 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
76}
77#endif /* HAVE_LIBLTTNG_UST_CTL */
78
761ffce2
FD
79/*
80 * Allocates, reserves and returns the error counter index for that trigger.
81 */
90aa04a1
FD
82enum event_notifier_error_accounting_status
83event_notifier_error_accounting_register_event_notifier(
84 const struct lttng_trigger *trigger,
85 uint64_t *error_counter_index);
86
87enum event_notifier_error_accounting_status
88event_notifier_error_accounting_get_count(
89 const struct lttng_trigger *trigger,
90 uint64_t *count);
91
92void event_notifier_error_accounting_unregister_event_notifier(
93 const struct lttng_trigger *trigger);
94
95void event_notifier_error_accounting_fini(void);
96
97#endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */
This page took 0.040052 seconds and 4 git commands to generate.