ia64/xen-unstable

view tools/libxen/include/xen_host_metrics.h @ 14045:7819d9332fba

Split the VBD I/O statistics out into a VBD_metrics class. Document the
VBD.type field, and add it to the C bindings (this was already in Xend).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 21:28:19 2007 +0000 (2007-02-20)
parents 4637dfae0856
children 42dd9055ee1f
line source
1 /*
2 * Copyright (c) 2006, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef XEN_HOST_METRICS_H
20 #define XEN_HOST_METRICS_H
22 #include "xen_common.h"
23 #include "xen_host_decl.h"
24 #include "xen_host_metrics_decl.h"
27 /*
28 * The host_metrics class.
29 *
30 * The metrics associated with a host.
31 */
34 /**
35 * Free the given xen_host_metrics. The given handle must have been
36 * allocated by this library.
37 */
38 extern void
39 xen_host_metrics_free(xen_host_metrics host_metrics);
42 typedef struct xen_host_metrics_set
43 {
44 size_t size;
45 xen_host_metrics *contents[];
46 } xen_host_metrics_set;
48 /**
49 * Allocate a xen_host_metrics_set of the given size.
50 */
51 extern xen_host_metrics_set *
52 xen_host_metrics_set_alloc(size_t size);
54 /**
55 * Free the given xen_host_metrics_set. The given set must have been
56 * allocated by this library.
57 */
58 extern void
59 xen_host_metrics_set_free(xen_host_metrics_set *set);
62 typedef struct xen_host_metrics_record
63 {
64 xen_host_metrics handle;
65 char *uuid;
66 struct xen_host_record_opt *host;
67 int64_t memory_total;
68 int64_t memory_free;
69 } xen_host_metrics_record;
71 /**
72 * Allocate a xen_host_metrics_record.
73 */
74 extern xen_host_metrics_record *
75 xen_host_metrics_record_alloc(void);
77 /**
78 * Free the given xen_host_metrics_record, and all referenced values.
79 * The given record must have been allocated by this library.
80 */
81 extern void
82 xen_host_metrics_record_free(xen_host_metrics_record *record);
85 typedef struct xen_host_metrics_record_opt
86 {
87 bool is_record;
88 union
89 {
90 xen_host_metrics handle;
91 xen_host_metrics_record *record;
92 } u;
93 } xen_host_metrics_record_opt;
95 /**
96 * Allocate a xen_host_metrics_record_opt.
97 */
98 extern xen_host_metrics_record_opt *
99 xen_host_metrics_record_opt_alloc(void);
101 /**
102 * Free the given xen_host_metrics_record_opt, and all referenced
103 * values. The given record_opt must have been allocated by this library.
104 */
105 extern void
106 xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt);
109 typedef struct xen_host_metrics_record_set
110 {
111 size_t size;
112 xen_host_metrics_record *contents[];
113 } xen_host_metrics_record_set;
115 /**
116 * Allocate a xen_host_metrics_record_set of the given size.
117 */
118 extern xen_host_metrics_record_set *
119 xen_host_metrics_record_set_alloc(size_t size);
121 /**
122 * Free the given xen_host_metrics_record_set, and all referenced
123 * values. The given set must have been allocated by this library.
124 */
125 extern void
126 xen_host_metrics_record_set_free(xen_host_metrics_record_set *set);
130 typedef struct xen_host_metrics_record_opt_set
131 {
132 size_t size;
133 xen_host_metrics_record_opt *contents[];
134 } xen_host_metrics_record_opt_set;
136 /**
137 * Allocate a xen_host_metrics_record_opt_set of the given size.
138 */
139 extern xen_host_metrics_record_opt_set *
140 xen_host_metrics_record_opt_set_alloc(size_t size);
142 /**
143 * Free the given xen_host_metrics_record_opt_set, and all referenced
144 * values. The given set must have been allocated by this library.
145 */
146 extern void
147 xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set);
150 /**
151 * Get a record containing the current state of the given host_metrics.
152 */
153 extern bool
154 xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics);
157 /**
158 * Get a reference to the host_metrics instance with the specified
159 * UUID.
160 */
161 extern bool
162 xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid);
165 /**
166 * Get the uuid field of the given host_metrics.
167 */
168 extern bool
169 xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics);
172 /**
173 * Get the host field of the given host_metrics.
174 */
175 extern bool
176 xen_host_metrics_get_host(xen_session *session, xen_host *result, xen_host_metrics host_metrics);
179 /**
180 * Get the memory/total field of the given host_metrics.
181 */
182 extern bool
183 xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
186 /**
187 * Get the memory/free field of the given host_metrics.
188 */
189 extern bool
190 xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
193 #endif