debuggers.hg

view tools/libxen/include/xen/api/xen_host_cpu.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 3ffdb094c2c0
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_HOST_CPU_H
20 #define XEN_HOST_CPU_H
22 #include <xen/api/xen_common.h>
23 #include <xen/api/xen_host_cpu_decl.h>
24 #include <xen/api/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 char *stepping;
72 char *flags;
73 char *features;
74 double utilisation;
75 } xen_host_cpu_record;
77 /**
78 * Allocate a xen_host_cpu_record.
79 */
80 extern xen_host_cpu_record *
81 xen_host_cpu_record_alloc(void);
83 /**
84 * Free the given xen_host_cpu_record, and all referenced values. The
85 * given record must have been allocated by this library.
86 */
87 extern void
88 xen_host_cpu_record_free(xen_host_cpu_record *record);
91 typedef struct xen_host_cpu_record_opt
92 {
93 bool is_record;
94 union
95 {
96 xen_host_cpu handle;
97 xen_host_cpu_record *record;
98 } u;
99 } xen_host_cpu_record_opt;
101 /**
102 * Allocate a xen_host_cpu_record_opt.
103 */
104 extern xen_host_cpu_record_opt *
105 xen_host_cpu_record_opt_alloc(void);
107 /**
108 * Free the given xen_host_cpu_record_opt, and all referenced values.
109 * The given record_opt must have been allocated by this library.
110 */
111 extern void
112 xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
115 typedef struct xen_host_cpu_record_set
116 {
117 size_t size;
118 xen_host_cpu_record *contents[];
119 } xen_host_cpu_record_set;
121 /**
122 * Allocate a xen_host_cpu_record_set of the given size.
123 */
124 extern xen_host_cpu_record_set *
125 xen_host_cpu_record_set_alloc(size_t size);
127 /**
128 * Free the given xen_host_cpu_record_set, and all referenced values.
129 * The given set must have been allocated by this library.
130 */
131 extern void
132 xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
136 typedef struct xen_host_cpu_record_opt_set
137 {
138 size_t size;
139 xen_host_cpu_record_opt *contents[];
140 } xen_host_cpu_record_opt_set;
142 /**
143 * Allocate a xen_host_cpu_record_opt_set of the given size.
144 */
145 extern xen_host_cpu_record_opt_set *
146 xen_host_cpu_record_opt_set_alloc(size_t size);
148 /**
149 * Free the given xen_host_cpu_record_opt_set, and all referenced
150 * values. The given set must have been allocated by this library.
151 */
152 extern void
153 xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
156 /**
157 * Get a record containing the current state of the given host_cpu.
158 */
159 extern bool
160 xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu);
163 /**
164 * Get a reference to the host_cpu instance with the specified UUID.
165 */
166 extern bool
167 xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid);
170 /**
171 * Get the uuid field of the given host_cpu.
172 */
173 extern bool
174 xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu);
177 /**
178 * Get the host field of the given host_cpu.
179 */
180 extern bool
181 xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu);
184 /**
185 * Get the number field of the given host_cpu.
186 */
187 extern bool
188 xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
191 /**
192 * Get the vendor field of the given host_cpu.
193 */
194 extern bool
195 xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu);
198 /**
199 * Get the speed field of the given host_cpu.
200 */
201 extern bool
202 xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
205 /**
206 * Get the modelname field of the given host_cpu.
207 */
208 extern bool
209 xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu);
212 /**
213 * Get the stepping field of the given host_cpu.
214 */
215 extern bool
216 xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu);
219 /**
220 * Get the flags field of the given host_cpu.
221 */
222 extern bool
223 xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu);
226 /**
227 * Get the features field of the given host_cpu.
228 */
229 extern bool
230 xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu);
233 /**
234 * Get the utilisation field of the given host_cpu.
235 */
236 extern bool
237 xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu);
240 /**
241 * Return a list of all the host_cpus known to the system.
242 */
243 extern bool
244 xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result);
247 #endif