| 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 _TRIGGER_ERROR_ACCOUNTING_H |
| 9 | #define _TRIGGER_ERROR_ACCOUNTING_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #include "ust-app.h" |
| 14 | |
| 15 | enum trigger_error_accounting_status { |
| 16 | TRIGGER_ERROR_ACCOUNTING_STATUS_OK, |
| 17 | TRIGGER_ERROR_ACCOUNTING_STATUS_ERR, |
| 18 | TRIGGER_ERROR_ACCOUNTING_STATUS_NOT_FOUND, |
| 19 | TRIGGER_ERROR_ACCOUNTING_STATUS_NOMEM, |
| 20 | TRIGGER_ERROR_ACCOUNTING_STATUS_NO_INDEX_AVAILABLE, |
| 21 | TRIGGER_ERROR_ACCOUNTING_STATUS_APP_DEAD, |
| 22 | }; |
| 23 | |
| 24 | void trigger_error_accounting_init(uint64_t nb_bucket); |
| 25 | |
| 26 | #ifdef HAVE_LIBLTTNG_UST_CTL |
| 27 | enum trigger_error_accounting_status trigger_error_accounting_register_app( |
| 28 | struct ust_app *app); |
| 29 | #else /* HAVE_LIBLTTNG_UST_CTL */ |
| 30 | static inline |
| 31 | enum trigger_error_accounting_status trigger_error_accounting_register_app( |
| 32 | struct ust_app *app) |
| 33 | { |
| 34 | return TRIGGER_ERROR_ACCOUNTING_STATUS_OK; |
| 35 | } |
| 36 | #endif /* HAVE_LIBLTTNG_UST_CTL */ |
| 37 | |
| 38 | void trigger_error_accounting_register_kernel(int kernel_fd); |
| 39 | |
| 40 | enum trigger_error_accounting_status trigger_error_accounting_register_trigger( |
| 41 | const struct lttng_trigger *trigger, |
| 42 | uint64_t *error_counter_index); |
| 43 | |
| 44 | enum trigger_error_accounting_status trigger_error_accounting_get_count( |
| 45 | const struct lttng_trigger *trigger, uint64_t *count); |
| 46 | |
| 47 | void trigger_error_accounting_unregister_trigger( |
| 48 | const struct lttng_trigger *trigger); |
| 49 | |
| 50 | void trigger_error_accounting_fini(void); |
| 51 | |
| 52 | #endif /* _TRIGGER_ERROR_ACCOUNTING_H */ |