ia64/xen-unstable

view tools/libxen/include/xen_vm_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 8773b1a38c83
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_VM_METRICS_H
20 #define XEN_VM_METRICS_H
22 #include "xen_common.h"
23 #include "xen_int_float_map.h"
24 #include "xen_vm_metrics_decl.h"
27 /*
28 * The VM_metrics class.
29 *
30 * The metrics associated with a VM.
31 */
34 /**
35 * Free the given xen_vm_metrics. The given handle must have been
36 * allocated by this library.
37 */
38 extern void
39 xen_vm_metrics_free(xen_vm_metrics vm_metrics);
42 typedef struct xen_vm_metrics_set
43 {
44 size_t size;
45 xen_vm_metrics *contents[];
46 } xen_vm_metrics_set;
48 /**
49 * Allocate a xen_vm_metrics_set of the given size.
50 */
51 extern xen_vm_metrics_set *
52 xen_vm_metrics_set_alloc(size_t size);
54 /**
55 * Free the given xen_vm_metrics_set. The given set must have been
56 * allocated by this library.
57 */
58 extern void
59 xen_vm_metrics_set_free(xen_vm_metrics_set *set);
62 typedef struct xen_vm_metrics_record
63 {
64 xen_vm_metrics handle;
65 char *uuid;
66 int64_t memory_actual;
67 int64_t vcpus_number;
68 xen_int_float_map *vcpus_utilisation;
69 } xen_vm_metrics_record;
71 /**
72 * Allocate a xen_vm_metrics_record.
73 */
74 extern xen_vm_metrics_record *
75 xen_vm_metrics_record_alloc(void);
77 /**
78 * Free the given xen_vm_metrics_record, and all referenced values.
79 * The given record must have been allocated by this library.
80 */
81 extern void
82 xen_vm_metrics_record_free(xen_vm_metrics_record *record);
85 typedef struct xen_vm_metrics_record_opt
86 {
87 bool is_record;
88 union
89 {
90 xen_vm_metrics handle;
91 xen_vm_metrics_record *record;
92 } u;
93 } xen_vm_metrics_record_opt;
95 /**
96 * Allocate a xen_vm_metrics_record_opt.
97 */
98 extern xen_vm_metrics_record_opt *
99 xen_vm_metrics_record_opt_alloc(void);
101 /**
102 * Free the given xen_vm_metrics_record_opt, and all referenced values.
103 * The given record_opt must have been allocated by this library.
104 */
105 extern void
106 xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt);
109 typedef struct xen_vm_metrics_record_set
110 {
111 size_t size;
112 xen_vm_metrics_record *contents[];
113 } xen_vm_metrics_record_set;
115 /**
116 * Allocate a xen_vm_metrics_record_set of the given size.
117 */
118 extern xen_vm_metrics_record_set *
119 xen_vm_metrics_record_set_alloc(size_t size);
121 /**
122 * Free the given xen_vm_metrics_record_set, and all referenced values.
123 * The given set must have been allocated by this library.
124 */
125 extern void
126 xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set);
130 typedef struct xen_vm_metrics_record_opt_set
131 {
132 size_t size;
133 xen_vm_metrics_record_opt *contents[];
134 } xen_vm_metrics_record_opt_set;
136 /**
137 * Allocate a xen_vm_metrics_record_opt_set of the given size.
138 */
139 extern xen_vm_metrics_record_opt_set *
140 xen_vm_metrics_record_opt_set_alloc(size_t size);
142 /**
143 * Free the given xen_vm_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_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set);
150 /**
151 * Get a record containing the current state of the given VM_metrics.
152 */
153 extern bool
154 xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics);
157 /**
158 * Get a reference to the VM_metrics instance with the specified UUID.
159 */
160 extern bool
161 xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid);
164 /**
165 * Get the uuid field of the given VM_metrics.
166 */
167 extern bool
168 xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics);
171 /**
172 * Get the memory/actual field of the given VM_metrics.
173 */
174 extern bool
175 xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
178 /**
179 * Get the VCPUs/number field of the given VM_metrics.
180 */
181 extern bool
182 xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics);
185 /**
186 * Get the VCPUs/utilisation field of the given VM_metrics.
187 */
188 extern bool
189 xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics);
192 #endif