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
27 struct lttng_health_thread
;
29 enum lttng_health_consumerd
{
30 LTTNG_HEALTH_CONSUMERD_UST_32
,
31 LTTNG_HEALTH_CONSUMERD_UST_64
,
32 LTTNG_HEALTH_CONSUMERD_KERNEL
,
34 NR_LTTNG_HEALTH_CONSUMERD
,
38 * lttng_health_create_sessiond - Create sessiond health object
40 * Return a newly allocated health object, or NULL on error.
42 struct lttng_health
*lttng_health_create_sessiond(void);
45 * lttng_health_create_consumerd - Create consumerd health object
46 * @consumerd: consumer daemon identifier
48 * Return a newly allocated health object, or NULL on error.
51 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd
);
54 * lttng_health_create_relayd - Create relayd health object
55 * @path: path to relay daemon health socket.
57 * "path" needs to refer to a local unix socket file matching the file
58 * used by the relay daemon to query.
60 * Return a newly allocated health object, or NULL on error.
62 struct lttng_health
*lttng_health_create_relayd(const char *path
);
65 * lttng_health_destroy - Destroy health object
66 * @health: health object to destroy
68 void lttng_health_destroy(struct lttng_health
*health
);
71 * lttng_health_query - Query component health
72 * @health: health state (input/output).
74 * Return 0 on success, negative value on error. This return value only
75 * reports if the query has been successfully performed, *NOT* the
76 * actual state. lttng_health_state() should be used for the latter.
78 int lttng_health_query(struct lttng_health
*health
);
81 * lttng_health_state - Inspect the state of a health structure
82 * @health: health state (input).
84 * "path" needs to refer to a local unix socket file matching the file
85 * used by the relay daemon to query.
87 * Return 0 on success, negative value if the component has at least one
88 * thread in error. It also returns a negative return value if
89 * lttng_health_query() has not yet successfully completed on @health.
91 int lttng_health_state(const struct lttng_health
*health
);
94 * lttng_health_get_nr_threads - Get number of threads in health component
95 * @health: health state (input)
97 * Return the number of threads (>= 0) on success, else negative value
100 int lttng_health_get_nr_threads(const struct lttng_health
*health
);
103 * lttng_health_get_thread - Get thread health
104 * @health: health state (input)
105 * @nth_thread: nth thread to lookup
107 * Return a pointer to the health thread, else NULL on error. This
108 * pointer should not be freed by the caller, and can be used until
109 * lttng_health_destroy() is called on @health.
111 const struct lttng_health_thread
*
112 lttng_health_get_thread(const struct lttng_health
*health
,
113 unsigned int nth_thread
);
116 * lttng_health_thread_state - Get thread health state
117 * @thread: thread health
119 * Return 0 if thread is OK, else negative error value.
121 int lttng_health_thread_state(const struct lttng_health_thread
*thread
);
124 * lttng_health_thread_name - Get thread name
125 * @thread: thread health
127 * Return thread name, NULL on error.
129 const char *lttng_health_thread_name(const struct lttng_health_thread
*thread
);
135 #endif /* LTTNG_HEALTH_H */