5 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License, version 2.1 only,
10 * as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 struct lttng_health_thread
;
25 enum lttng_health_consumerd
{
26 LTTNG_HEALTH_CONSUMERD_UST_32
,
27 LTTNG_HEALTH_CONSUMERD_UST_64
,
28 LTTNG_HEALTH_CONSUMERD_KERNEL
,
32 * lttng_health_create_sessiond - Create sessiond health object
34 * Return a newly allocated health object, or NULL on error.
36 struct lttng_health
*lttng_health_create_sessiond(void);
39 * lttng_health_create_consumerd - Create consumerd health object
40 * @consumerd: consumer daemon identifier
42 * Return a newly allocated health object, or NULL on error.
45 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd
);
48 * lttng_health_create_relayd - Create relayd health object
49 * @path: path to relay daemon health socket.
51 * "path" needs to refer to a local unix socket file matching the file
52 * used by the relay daemon to query.
54 * Return a newly allocated health object, or NULL on error.
56 struct lttng_health
*lttng_health_create_relayd(const char *path
);
59 * lttng_health_destroy - Destroy health object
60 * @health: health object to destroy
62 void lttng_health_destroy(struct lttng_health
*health
);
65 * lttng_health_query - Query component health
66 * @health: health state (input/output).
68 * Return 0 on success, negative value on error. This return value only
69 * reports if the query has been successfully performed, *NOT* the
70 * actual state. lttng_health_state() should be used for the latter.
72 int lttng_health_query(struct lttng_health
*health
);
75 * lttng_health_state - Inspect the state of a health structure
76 * @health: health state (input).
78 * "path" needs to refer to a local unix socket file matching the file
79 * used by the relay daemon to query.
81 * Return 0 on success, negative value if the component has at least one
82 * thread in error. It also returns a negative return value if
83 * lttng_health_query() has not yet successfully completed on @health.
85 int lttng_health_state(const struct lttng_health
*health
);
88 * lttng_health_get_nr_threads - Get number of threads in health component
89 * @health: health state (input)
91 * Return the number of threads (>= 0) on success, else negative value
94 int lttng_health_get_nr_threads(const struct lttng_health
*health
);
97 * lttng_health_get_thread - Get thread health
98 * @health: health state (input)
99 * @nth_thread: nth thread to lookup
101 * Return a pointer to the health thread, else NULL on error. This
102 * pointer should not be freed by the caller, and can be used until
103 * lttng_health_destroy() is called on @health.
105 const struct lttng_health_thread
*
106 lttng_health_get_thread(const struct lttng_health
*health
,
110 * lttng_health_thread_state - Get thread health state
111 * @thread: thread health
113 * Return 0 if thread is OK, else negative error value.
115 int lttng_health_thread_state(const struct lttng_health_thread
*thread
);
118 * lttng_health_thread_name - Get thread name
119 * @thread: thread health
121 * Return thread name, NULL on error.
123 const char *lttng_health_thread_name(const struct lttng_health_thread
*thread
);
125 #endif /* LTTNG_HEALTH_H */