5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * SPDX-License-Identifier: LGPL-2.1-only
12 #include <lttng/lttng-export.h>
19 struct lttng_health_thread
;
21 enum lttng_health_consumerd
{
22 LTTNG_HEALTH_CONSUMERD_UST_32
,
23 LTTNG_HEALTH_CONSUMERD_UST_64
,
24 LTTNG_HEALTH_CONSUMERD_KERNEL
,
26 NR_LTTNG_HEALTH_CONSUMERD
,
30 * lttng_health_create_sessiond - Create sessiond health object
32 * Return a newly allocated health object, or NULL on error.
34 LTTNG_EXPORT
extern struct lttng_health
*lttng_health_create_sessiond(void);
37 * lttng_health_create_consumerd - Create consumerd health object
38 * @consumerd: consumer daemon identifier
40 * Return a newly allocated health object, or NULL on error.
42 LTTNG_EXPORT
extern struct lttng_health
*
43 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd
);
46 * lttng_health_create_relayd - Create relayd health object
47 * @path: path to relay daemon health socket.
49 * "path" needs to refer to a local unix socket file matching the file
50 * used by the relay daemon to query.
52 * Return a newly allocated health object, or NULL on error.
54 LTTNG_EXPORT
extern struct lttng_health
*lttng_health_create_relayd(const char *path
);
57 * lttng_health_destroy - Destroy health object
58 * @health: health object to destroy
60 LTTNG_EXPORT
extern void lttng_health_destroy(struct lttng_health
*health
);
63 * lttng_health_query - Query component health
64 * @health: health state (input/output).
66 * Return 0 on success, negative value on error. This return value only
67 * reports if the query has been successfully performed, *NOT* the
68 * actual state. lttng_health_state() should be used for the latter.
70 LTTNG_EXPORT
extern int lttng_health_query(struct lttng_health
*health
);
73 * lttng_health_state - Inspect the state of a health structure
74 * @health: health state (input).
76 * "path" needs to refer to a local unix socket file matching the file
77 * used by the relay daemon to query.
79 * Return 0 on success, negative value if the component has at least one
80 * thread in error. It also returns a negative return value if
81 * lttng_health_query() has not yet successfully completed on @health.
83 LTTNG_EXPORT
extern int lttng_health_state(const struct lttng_health
*health
);
86 * lttng_health_get_nr_threads - Get number of threads in health component
87 * @health: health state (input)
89 * Return the number of threads (>= 0) on success, else negative value
92 LTTNG_EXPORT
extern int lttng_health_get_nr_threads(const struct lttng_health
*health
);
95 * lttng_health_get_thread - Get thread health
96 * @health: health state (input)
97 * @nth_thread: nth thread to lookup
99 * Return a pointer to the health thread, else NULL on error. This
100 * pointer should not be freed by the caller, and can be used until
101 * lttng_health_destroy() is called on @health.
103 LTTNG_EXPORT
extern const struct lttng_health_thread
*
104 lttng_health_get_thread(const struct lttng_health
*health
, unsigned int nth_thread
);
107 * lttng_health_thread_state - Get thread health state
108 * @thread: thread health
110 * Return 0 if thread is OK, else negative error value.
112 LTTNG_EXPORT
extern int lttng_health_thread_state(const struct lttng_health_thread
*thread
);
115 * lttng_health_thread_name - Get thread name
116 * @thread: thread health
118 * Return thread name, NULL on error.
120 LTTNG_EXPORT
extern const char *lttng_health_thread_name(const struct lttng_health_thread
*thread
);
126 #endif /* LTTNG_HEALTH_H */