ia64/xen-unstable

view tools/libxen/include/xen_host_cpu.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 44d565181709
children 50e0616fd012
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_CPU_H
20 #define XEN_HOST_CPU_H
22 #include "xen_common.h"
23 #include "xen_host_cpu_decl.h"
24 #include "xen_host_decl.h"
27 /*
28 * The host_cpu class.
29 *
30 * A physical CPU.
31 */
34 /**
35 * Free the given xen_host_cpu. The given handle must have been
36 * allocated by this library.
37 */
38 extern void
39 xen_host_cpu_free(xen_host_cpu host_cpu);
42 typedef struct xen_host_cpu_set
43 {
44 size_t size;
45 xen_host_cpu *contents[];
46 } xen_host_cpu_set;
48 /**
49 * Allocate a xen_host_cpu_set of the given size.
50 */
51 extern xen_host_cpu_set *
52 xen_host_cpu_set_alloc(size_t size);
54 /**
55 * Free the given xen_host_cpu_set. The given set must have been
56 * allocated by this library.
57 */
58 extern void
59 xen_host_cpu_set_free(xen_host_cpu_set *set);
62 typedef struct xen_host_cpu_record
63 {
64 xen_host_cpu handle;
65 char *uuid;
66 struct xen_host_record_opt *host;
67 int64_t number;
68 char *vendor;
69 int64_t speed;
70 char *modelname;
71 double utilisation;
72 } xen_host_cpu_record;
74 /**
75 * Allocate a xen_host_cpu_record.
76 */
77 extern xen_host_cpu_record *
78 xen_host_cpu_record_alloc(void);
80 /**
81 * Free the given xen_host_cpu_record, and all referenced values. The
82 * given record must have been allocated by this library.
83 */
84 extern void
85 xen_host_cpu_record_free(xen_host_cpu_record *record);
88 typedef struct xen_host_cpu_record_opt
89 {
90 bool is_record;
91 union
92 {
93 xen_host_cpu handle;
94 xen_host_cpu_record *record;
95 } u;
96 } xen_host_cpu_record_opt;
98 /**
99 * Allocate a xen_host_cpu_record_opt.
100 */
101 extern xen_host_cpu_record_opt *
102 xen_host_cpu_record_opt_alloc(void);
104 /**
105 * Free the given xen_host_cpu_record_opt, and all referenced values.
106 * The given record_opt must have been allocated by this library.
107 */
108 extern void
109 xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
112 typedef struct xen_host_cpu_record_set
113 {
114 size_t size;
115 xen_host_cpu_record *contents[];
116 } xen_host_cpu_record_set;
118 /**
119 * Allocate a xen_host_cpu_record_set of the given size.
120 */
121 extern xen_host_cpu_record_set *
122 xen_host_cpu_record_set_alloc(size_t size);
124 /**
125 * Free the given xen_host_cpu_record_set, and all referenced values.
126 * The given set must have been allocated by this library.
127 */
128 extern void
129 xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
133 typedef struct xen_host_cpu_record_opt_set
134 {
135 size_t size;
136 xen_host_cpu_record_opt *contents[];
137 } xen_host_cpu_record_opt_set;
139 /**
140 * Allocate a xen_host_cpu_record_opt_set of the given size.
141 */
142 extern xen_host_cpu_record_opt_set *
143 xen_host_cpu_record_opt_set_alloc(size_t size);
145 /**
146 * Free the given xen_host_cpu_record_opt_set, and all referenced
147 * values. The given set must have been allocated by this library.
148 */
149 extern void
150 xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
153 /**
154 * Get a record containing the current state of the given host_cpu.
155 */
156 extern bool
157 xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu);
160 /**
161 * Get a reference to the host_cpu instance with the specified UUID.
162 */
163 extern bool
164 xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid);
167 /**
168 * Create a new host_cpu instance, and return its handle.
169 */
170 extern bool
171 xen_host_cpu_create(xen_session *session, xen_host_cpu *result, xen_host_cpu_record *record);
174 /**
175 * Destroy the specified host_cpu instance.
176 */
177 extern bool
178 xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu);
181 /**
182 * Get the uuid field of the given host_cpu.
183 */
184 extern bool
185 xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu);
188 /**
189 * Get the host field of the given host_cpu.
190 */
191 extern bool
192 xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu);
195 /**
196 * Get the number field of the given host_cpu.
197 */
198 extern bool
199 xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
202 /**
203 * Get the vendor field of the given host_cpu.
204 */
205 extern bool
206 xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu);
209 /**
210 * Get the speed field of the given host_cpu.
211 */
212 extern bool
213 xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
216 /**
217 * Get the modelname field of the given host_cpu.
218 */
219 extern bool
220 xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu);
223 /**
224 * Get the utilisation field of the given host_cpu.
225 */
226 extern bool
227 xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu);
230 #endif