Typo: occured -> occurred
[lttng-tools.git] / include / lttng / health.h
CommitLineData
d74df422
MD
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 * 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.
11 *
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
15 * for more details.
16 *
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
20 */
21
2c1142ac
JG
22#ifdef __cplusplus
23extern "C" {
24#endif
25
d74df422
MD
26struct lttng_health;
27struct lttng_health_thread;
28
29enum lttng_health_consumerd {
30 LTTNG_HEALTH_CONSUMERD_UST_32,
31 LTTNG_HEALTH_CONSUMERD_UST_64,
32 LTTNG_HEALTH_CONSUMERD_KERNEL,
6c71277b
MD
33
34 NR_LTTNG_HEALTH_CONSUMERD,
d74df422
MD
35};
36
37/**
38 * lttng_health_create_sessiond - Create sessiond health object
39 *
40 * Return a newly allocated health object, or NULL on error.
41 */
42struct lttng_health *lttng_health_create_sessiond(void);
43
44/**
45 * lttng_health_create_consumerd - Create consumerd health object
46 * @consumerd: consumer daemon identifier
47 *
48 * Return a newly allocated health object, or NULL on error.
49 */
50struct lttng_health *
51 lttng_health_create_consumerd(enum lttng_health_consumerd consumerd);
52
53/**
54 * lttng_health_create_relayd - Create relayd health object
55 * @path: path to relay daemon health socket.
56 *
57 * "path" needs to refer to a local unix socket file matching the file
58 * used by the relay daemon to query.
59 *
60 * Return a newly allocated health object, or NULL on error.
61 */
62struct lttng_health *lttng_health_create_relayd(const char *path);
63
64/**
65 * lttng_health_destroy - Destroy health object
66 * @health: health object to destroy
67 */
68void lttng_health_destroy(struct lttng_health *health);
69
70/**
71 * lttng_health_query - Query component health
72 * @health: health state (input/output).
73 *
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.
77 */
78int lttng_health_query(struct lttng_health *health);
79
80/**
81 * lttng_health_state - Inspect the state of a health structure
82 * @health: health state (input).
83 *
84 * "path" needs to refer to a local unix socket file matching the file
85 * used by the relay daemon to query.
86 *
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.
90 */
91int lttng_health_state(const struct lttng_health *health);
92
93/**
94 * lttng_health_get_nr_threads - Get number of threads in health component
95 * @health: health state (input)
96 *
97 * Return the number of threads (>= 0) on success, else negative value
98 * on error.
99 */
100int lttng_health_get_nr_threads(const struct lttng_health *health);
101
102/**
103 * lttng_health_get_thread - Get thread health
104 * @health: health state (input)
105 * @nth_thread: nth thread to lookup
106 *
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.
110 */
111const struct lttng_health_thread *
112 lttng_health_get_thread(const struct lttng_health *health,
6c71277b 113 unsigned int nth_thread);
d74df422
MD
114
115/**
116 * lttng_health_thread_state - Get thread health state
117 * @thread: thread health
118 *
119 * Return 0 if thread is OK, else negative error value.
120 */
121int lttng_health_thread_state(const struct lttng_health_thread *thread);
122
123/**
124 * lttng_health_thread_name - Get thread name
125 * @thread: thread health
126 *
127 * Return thread name, NULL on error.
128 */
129const char *lttng_health_thread_name(const struct lttng_health_thread *thread);
130
2c1142ac
JG
131#ifdef __cplusplus
132}
133#endif
134
d74df422 135#endif /* LTTNG_HEALTH_H */
This page took 0.036297 seconds and 4 git commands to generate.