source: trunk/packages/xen-3.1/xen-3.1/tools/libxen/include/xen/api/xen_host_cpu.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 5.6 KB
Line 
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 */
18
19#ifndef XEN_HOST_CPU_H
20#define XEN_HOST_CPU_H
21
22#include <xen/api/xen_common.h>
23#include <xen/api/xen_host_cpu_decl.h>
24#include <xen/api/xen_host_decl.h>
25
26
27/*
28 * The host_cpu class.
29 *
30 * A physical CPU.
31 */
32
33
34/**
35 * Free the given xen_host_cpu.  The given handle must have been
36 * allocated by this library.
37 */
38extern void
39xen_host_cpu_free(xen_host_cpu host_cpu);
40
41
42typedef struct xen_host_cpu_set
43{
44    size_t size;
45    xen_host_cpu *contents[];
46} xen_host_cpu_set;
47
48/**
49 * Allocate a xen_host_cpu_set of the given size.
50 */
51extern xen_host_cpu_set *
52xen_host_cpu_set_alloc(size_t size);
53
54/**
55 * Free the given xen_host_cpu_set.  The given set must have been
56 * allocated by this library.
57 */
58extern void
59xen_host_cpu_set_free(xen_host_cpu_set *set);
60
61
62typedef 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;
76
77/**
78 * Allocate a xen_host_cpu_record.
79 */
80extern xen_host_cpu_record *
81xen_host_cpu_record_alloc(void);
82
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 */
87extern void
88xen_host_cpu_record_free(xen_host_cpu_record *record);
89
90
91typedef 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;
100
101/**
102 * Allocate a xen_host_cpu_record_opt.
103 */
104extern xen_host_cpu_record_opt *
105xen_host_cpu_record_opt_alloc(void);
106
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 */
111extern void
112xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
113
114
115typedef struct xen_host_cpu_record_set
116{
117    size_t size;
118    xen_host_cpu_record *contents[];
119} xen_host_cpu_record_set;
120
121/**
122 * Allocate a xen_host_cpu_record_set of the given size.
123 */
124extern xen_host_cpu_record_set *
125xen_host_cpu_record_set_alloc(size_t size);
126
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 */
131extern void
132xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
133
134
135
136typedef 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;
141
142/**
143 * Allocate a xen_host_cpu_record_opt_set of the given size.
144 */
145extern xen_host_cpu_record_opt_set *
146xen_host_cpu_record_opt_set_alloc(size_t size);
147
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 */
152extern void
153xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
154
155
156/**
157 * Get a record containing the current state of the given host_cpu.
158 */
159extern bool
160xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result, xen_host_cpu host_cpu);
161
162
163/**
164 * Get a reference to the host_cpu instance with the specified UUID.
165 */
166extern bool
167xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid);
168
169
170/**
171 * Get the uuid field of the given host_cpu.
172 */
173extern bool
174xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu host_cpu);
175
176
177/**
178 * Get the host field of the given host_cpu.
179 */
180extern bool
181xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu);
182
183
184/**
185 * Get the number field of the given host_cpu.
186 */
187extern bool
188xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
189
190
191/**
192 * Get the vendor field of the given host_cpu.
193 */
194extern bool
195xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu);
196
197
198/**
199 * Get the speed field of the given host_cpu.
200 */
201extern bool
202xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu);
203
204
205/**
206 * Get the modelname field of the given host_cpu.
207 */
208extern bool
209xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu);
210
211
212/**
213 * Get the stepping field of the given host_cpu.
214 */
215extern bool
216xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu);
217
218
219/**
220 * Get the flags field of the given host_cpu.
221 */
222extern bool
223xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu);
224
225
226/**
227 * Get the features field of the given host_cpu.
228 */
229extern bool
230xen_host_cpu_get_features(xen_session *session, char **result, xen_host_cpu host_cpu);
231
232
233/**
234 * Get the utilisation field of the given host_cpu.
235 */
236extern bool
237xen_host_cpu_get_utilisation(xen_session *session, double *result, xen_host_cpu host_cpu);
238
239
240/**
241 * Return a list of all the host_cpus known to the system.
242 */
243extern bool
244xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result);
245
246
247#endif
Note: See TracBrowser for help on using the repository browser.