Introduce kernel-probe locations
[lttng-tools.git] / include / lttng / health.h
CommitLineData
d74df422
MD
1#ifndef LTTNG_HEALTH_H
2#define LTTNG_HEALTH_H
3
4/*
ab5be9fa
MJ
5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
d74df422 7 *
ab5be9fa 8 * SPDX-License-Identifier: LGPL-2.1-only
d74df422 9 *
d74df422
MD
10 */
11
2c1142ac
JG
12#ifdef __cplusplus
13extern "C" {
14#endif
15
d74df422
MD
16struct lttng_health;
17struct lttng_health_thread;
18
19enum lttng_health_consumerd {
20 LTTNG_HEALTH_CONSUMERD_UST_32,
21 LTTNG_HEALTH_CONSUMERD_UST_64,
22 LTTNG_HEALTH_CONSUMERD_KERNEL,
6c71277b
MD
23
24 NR_LTTNG_HEALTH_CONSUMERD,
d74df422
MD
25};
26
27/**
28 * lttng_health_create_sessiond - Create sessiond health object
29 *
30 * Return a newly allocated health object, or NULL on error.
31 */
32struct lttng_health *lttng_health_create_sessiond(void);
33
34/**
35 * lttng_health_create_consumerd - Create consumerd health object
36 * @consumerd: consumer daemon identifier
37 *
38 * Return a newly allocated health object, or NULL on error.
39 */
40struct lttng_health *
41 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
42
43/**
44 * lttng_health_create_relayd - Create relayd health object
45 * @path: path to relay daemon health socket.
46 *
47 * "path" needs to refer to a local unix socket file matching the file
48 * used by the relay daemon to query.
49 *
50 * Return a newly allocated health object, or NULL on error.
51 */
52struct lttng_health *lttng_health_create_relayd(const char *path);
53
54/**
55 * lttng_health_destroy - Destroy health object
56 * @health: health object to destroy
57 */
58void lttng_health_destroy(struct lttng_health *health);
59
60/**
61 * lttng_health_query - Query component health
62 * @health: health state (input/output).
63 *
64 * Return 0 on success, negative value on error. This return value only
65 * reports if the query has been successfully performed, *NOT* the
66 * actual state. lttng_health_state() should be used for the latter.
67 */
68int lttng_health_query(struct lttng_health *health);
69
70/**
71 * lttng_health_state - Inspect the state of a health structure
72 * @health: health state (input).
73 *
74 * "path" needs to refer to a local unix socket file matching the file
75 * used by the relay daemon to query.
76 *
77 * Return 0 on success, negative value if the component has at least one
78 * thread in error. It also returns a negative return value if
79 * lttng_health_query() has not yet successfully completed on @health.
80 */
81int lttng_health_state(const struct lttng_health *health);
82
83/**
84 * lttng_health_get_nr_threads - Get number of threads in health component
85 * @health: health state (input)
86 *
87 * Return the number of threads (>= 0) on success, else negative value
88 * on error.
89 */
90int lttng_health_get_nr_threads(const struct lttng_health *health);
91
92/**
93 * lttng_health_get_thread - Get thread health
94 * @health: health state (input)
95 * @nth_thread: nth thread to lookup
96 *
97 * Return a pointer to the health thread, else NULL on error. This
98 * pointer should not be freed by the caller, and can be used until
99 * lttng_health_destroy() is called on @health.
100 */
101const struct lttng_health_thread *
102 lttng_health_get_thread(const struct lttng_health *health,
6c71277b 103 unsigned int nth_thread);
d74df422
MD
104
105/**
106 * lttng_health_thread_state - Get thread health state
107 * @thread: thread health
108 *
109 * Return 0 if thread is OK, else negative error value.
110 */
111int lttng_health_thread_state(const struct lttng_health_thread *thread);
112
113/**
114 * lttng_health_thread_name - Get thread name
115 * @thread: thread health
116 *
117 * Return thread name, NULL on error.
118 */
119const char *lttng_health_thread_name(const struct lttng_health_thread *thread);
120
2c1142ac
JG
121#ifdef __cplusplus
122}
123#endif
124
d74df422 125#endif /* LTTNG_HEALTH_H */
This page took 0.038154 seconds and 4 git commands to generate.