Clean-up: remove instances of loop initial declarations
[lttng-tools.git] / include / lttng / health.h
1 #ifndef LTTNG_HEALTH_H
2 #define LTTNG_HEALTH_H
3
4 /*
5 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
8 * SPDX-License-Identifier: LGPL-2.1-only
9 *
10 */
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 struct lttng_health;
17 struct lttng_health_thread;
18
19 enum lttng_health_consumerd {
20 LTTNG_HEALTH_CONSUMERD_UST_32,
21 LTTNG_HEALTH_CONSUMERD_UST_64,
22 LTTNG_HEALTH_CONSUMERD_KERNEL,
23
24 NR_LTTNG_HEALTH_CONSUMERD,
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 */
32 struct 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 */
40 struct 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 */
52 struct 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 */
58 void 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 */
68 int 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 */
81 int 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 */
90 int 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 */
101 const struct lttng_health_thread *
102 lttng_health_get_thread(const struct lttng_health *health,
103 unsigned int nth_thread);
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 */
111 int 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 */
119 const char *lttng_health_thread_name(const struct lttng_health_thread *thread);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* LTTNG_HEALTH_H */
This page took 0.035033 seconds and 5 git commands to generate.