ia64/xen-unstable

view tools/libxen/include/xen_vbd_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
children 42dd9055ee1f
line source
1 /*
2 * Copyright (c) 2006-2007, 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_VBD_METRICS_H
20 #define XEN_VBD_METRICS_H
22 #include "xen_common.h"
23 #include "xen_vbd_metrics_decl.h"
26 /*
27 * The VBD_metrics class.
28 *
29 * The metrics associated with a virtual block device.
30 */
33 /**
34 * Free the given xen_vbd_metrics. The given handle must have been
35 * allocated by this library.
36 */
37 extern void
38 xen_vbd_metrics_free(xen_vbd_metrics vbd_metrics);
41 typedef struct xen_vbd_metrics_set
42 {
43 size_t size;
44 xen_vbd_metrics *contents[];
45 } xen_vbd_metrics_set;
47 /**
48 * Allocate a xen_vbd_metrics_set of the given size.
49 */
50 extern xen_vbd_metrics_set *
51 xen_vbd_metrics_set_alloc(size_t size);
53 /**
54 * Free the given xen_vbd_metrics_set. The given set must have been
55 * allocated by this library.
56 */
57 extern void
58 xen_vbd_metrics_set_free(xen_vbd_metrics_set *set);
61 typedef struct xen_vbd_metrics_record
62 {
63 xen_vbd_metrics handle;
64 char *uuid;
65 double io_read_kbs;
66 double io_write_kbs;
67 } xen_vbd_metrics_record;
69 /**
70 * Allocate a xen_vbd_metrics_record.
71 */
72 extern xen_vbd_metrics_record *
73 xen_vbd_metrics_record_alloc(void);
75 /**
76 * Free the given xen_vbd_metrics_record, and all referenced values.
77 * The given record must have been allocated by this library.
78 */
79 extern void
80 xen_vbd_metrics_record_free(xen_vbd_metrics_record *record);
83 typedef struct xen_vbd_metrics_record_opt
84 {
85 bool is_record;
86 union
87 {
88 xen_vbd_metrics handle;
89 xen_vbd_metrics_record *record;
90 } u;
91 } xen_vbd_metrics_record_opt;
93 /**
94 * Allocate a xen_vbd_metrics_record_opt.
95 */
96 extern xen_vbd_metrics_record_opt *
97 xen_vbd_metrics_record_opt_alloc(void);
99 /**
100 * Free the given xen_vbd_metrics_record_opt, and all referenced
101 * values. The given record_opt must have been allocated by this library.
102 */
103 extern void
104 xen_vbd_metrics_record_opt_free(xen_vbd_metrics_record_opt *record_opt);
107 typedef struct xen_vbd_metrics_record_set
108 {
109 size_t size;
110 xen_vbd_metrics_record *contents[];
111 } xen_vbd_metrics_record_set;
113 /**
114 * Allocate a xen_vbd_metrics_record_set of the given size.
115 */
116 extern xen_vbd_metrics_record_set *
117 xen_vbd_metrics_record_set_alloc(size_t size);
119 /**
120 * Free the given xen_vbd_metrics_record_set, and all referenced
121 * values. The given set must have been allocated by this library.
122 */
123 extern void
124 xen_vbd_metrics_record_set_free(xen_vbd_metrics_record_set *set);
128 typedef struct xen_vbd_metrics_record_opt_set
129 {
130 size_t size;
131 xen_vbd_metrics_record_opt *contents[];
132 } xen_vbd_metrics_record_opt_set;
134 /**
135 * Allocate a xen_vbd_metrics_record_opt_set of the given size.
136 */
137 extern xen_vbd_metrics_record_opt_set *
138 xen_vbd_metrics_record_opt_set_alloc(size_t size);
140 /**
141 * Free the given xen_vbd_metrics_record_opt_set, and all referenced
142 * values. The given set must have been allocated by this library.
143 */
144 extern void
145 xen_vbd_metrics_record_opt_set_free(xen_vbd_metrics_record_opt_set *set);
148 /**
149 * Get a record containing the current state of the given VBD_metrics.
150 */
151 extern bool
152 xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics);
155 /**
156 * Get a reference to the VBD_metrics instance with the specified UUID.
157 */
158 extern bool
159 xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid);
162 /**
163 * Get the uuid field of the given VBD_metrics.
164 */
165 extern bool
166 xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics);
169 /**
170 * Get the io/read_kbs field of the given VBD_metrics.
171 */
172 extern bool
173 xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
176 /**
177 * Get the io/write_kbs field of the given VBD_metrics.
178 */
179 extern bool
180 xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics);
183 #endif