sessiond: add support for anonymous triggers
[lttng-tools.git] / src / bin / lttng-sessiond / event-notifier-error-accounting.h
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
533a90fb
FD
15#include "ust-app.h"
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,
90aa04a1
FD
24};
25
761ffce2
FD
26/*
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.
30 */
90aa04a1 31enum event_notifier_error_accounting_status
761ffce2
FD
32event_notifier_error_accounting_init(uint64_t buffer_size_kernel,
33 uint64_t buffer_size_ust);
90aa04a1 34
761ffce2
FD
35/*
36 * Register the kernel event notifier group.
37 * This allocates the counter object on the kernel side.
38 */
90aa04a1
FD
39enum event_notifier_error_accounting_status
40event_notifier_error_accounting_register_kernel(
41 int kernel_event_notifier_group_fd);
42
533a90fb 43#ifdef HAVE_LIBLTTNG_UST_CTL
761ffce2
FD
44
45/*
46 * Register a UST application.
47 *
48 * This reuses (or creates) the counter object of the app UID.
49 */
533a90fb
FD
50enum event_notifier_error_accounting_status
51event_notifier_error_accounting_register_app(struct ust_app *app);
52
761ffce2
FD
53/*
54 * Unregister a UST application.
55 */
533a90fb
FD
56enum event_notifier_error_accounting_status
57event_notifier_error_accounting_unregister_app(struct ust_app *app);
58#else /* HAVE_LIBLTTNG_UST_CTL */
59static inline
60enum event_notifier_error_accounting_status
61event_notifier_error_accounting_register_app(struct ust_app *app)
62{
63 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
64}
65
66static inline
67enum event_notifier_error_accounting_status
68event_notifier_error_accounting_unregister_app(struct ust_app *app)
69{
70 return EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
71}
72#endif /* HAVE_LIBLTTNG_UST_CTL */
73
761ffce2
FD
74/*
75 * Allocates, reserves and returns the error counter index for that trigger.
76 */
90aa04a1
FD
77enum event_notifier_error_accounting_status
78event_notifier_error_accounting_register_event_notifier(
79 const struct lttng_trigger *trigger,
80 uint64_t *error_counter_index);
81
82enum event_notifier_error_accounting_status
83event_notifier_error_accounting_get_count(
84 const struct lttng_trigger *trigger,
85 uint64_t *count);
86
87void event_notifier_error_accounting_unregister_event_notifier(
88 const struct lttng_trigger *trigger);
89
90void event_notifier_error_accounting_fini(void);
91
92#endif /* _EVENT_NOTIFIER_ERROR_ACCOUNTING_H */
This page took 0.026198 seconds and 4 git commands to generate.