source: trunk/packages/xen-3.1/xen-3.1/tools/libxen/include/xen/api/xen_host_metrics.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: 4.9 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_METRICS_H
20#define XEN_HOST_METRICS_H
21
22#include <xen/api/xen_common.h>
23#include <xen/api/xen_host_metrics_decl.h>
24
25
26/*
27 * The host_metrics class.
28 *
29 * The metrics associated with a host.
30 */
31
32
33/**
34 * Free the given xen_host_metrics.  The given handle must have been
35 * allocated by this library.
36 */
37extern void
38xen_host_metrics_free(xen_host_metrics host_metrics);
39
40
41typedef struct xen_host_metrics_set
42{
43    size_t size;
44    xen_host_metrics *contents[];
45} xen_host_metrics_set;
46
47/**
48 * Allocate a xen_host_metrics_set of the given size.
49 */
50extern xen_host_metrics_set *
51xen_host_metrics_set_alloc(size_t size);
52
53/**
54 * Free the given xen_host_metrics_set.  The given set must have been
55 * allocated by this library.
56 */
57extern void
58xen_host_metrics_set_free(xen_host_metrics_set *set);
59
60
61typedef struct xen_host_metrics_record
62{
63    xen_host_metrics handle;
64    char *uuid;
65    int64_t memory_total;
66    int64_t memory_free;
67    time_t last_updated;
68} xen_host_metrics_record;
69
70/**
71 * Allocate a xen_host_metrics_record.
72 */
73extern xen_host_metrics_record *
74xen_host_metrics_record_alloc(void);
75
76/**
77 * Free the given xen_host_metrics_record, and all referenced values.
78 * The given record must have been allocated by this library.
79 */
80extern void
81xen_host_metrics_record_free(xen_host_metrics_record *record);
82
83
84typedef struct xen_host_metrics_record_opt
85{
86    bool is_record;
87    union
88    {
89        xen_host_metrics handle;
90        xen_host_metrics_record *record;
91    } u;
92} xen_host_metrics_record_opt;
93
94/**
95 * Allocate a xen_host_metrics_record_opt.
96 */
97extern xen_host_metrics_record_opt *
98xen_host_metrics_record_opt_alloc(void);
99
100/**
101 * Free the given xen_host_metrics_record_opt, and all referenced
102 * values.  The given record_opt must have been allocated by this library.
103 */
104extern void
105xen_host_metrics_record_opt_free(xen_host_metrics_record_opt *record_opt);
106
107
108typedef struct xen_host_metrics_record_set
109{
110    size_t size;
111    xen_host_metrics_record *contents[];
112} xen_host_metrics_record_set;
113
114/**
115 * Allocate a xen_host_metrics_record_set of the given size.
116 */
117extern xen_host_metrics_record_set *
118xen_host_metrics_record_set_alloc(size_t size);
119
120/**
121 * Free the given xen_host_metrics_record_set, and all referenced
122 * values.  The given set must have been allocated by this library.
123 */
124extern void
125xen_host_metrics_record_set_free(xen_host_metrics_record_set *set);
126
127
128
129typedef struct xen_host_metrics_record_opt_set
130{
131    size_t size;
132    xen_host_metrics_record_opt *contents[];
133} xen_host_metrics_record_opt_set;
134
135/**
136 * Allocate a xen_host_metrics_record_opt_set of the given size.
137 */
138extern xen_host_metrics_record_opt_set *
139xen_host_metrics_record_opt_set_alloc(size_t size);
140
141/**
142 * Free the given xen_host_metrics_record_opt_set, and all referenced
143 * values.  The given set must have been allocated by this library.
144 */
145extern void
146xen_host_metrics_record_opt_set_free(xen_host_metrics_record_opt_set *set);
147
148
149/**
150 * Get a record containing the current state of the given host_metrics.
151 */
152extern bool
153xen_host_metrics_get_record(xen_session *session, xen_host_metrics_record **result, xen_host_metrics host_metrics);
154
155
156/**
157 * Get a reference to the host_metrics instance with the specified
158 * UUID.
159 */
160extern bool
161xen_host_metrics_get_by_uuid(xen_session *session, xen_host_metrics *result, char *uuid);
162
163
164/**
165 * Get the uuid field of the given host_metrics.
166 */
167extern bool
168xen_host_metrics_get_uuid(xen_session *session, char **result, xen_host_metrics host_metrics);
169
170
171/**
172 * Get the memory/total field of the given host_metrics.
173 */
174extern bool
175xen_host_metrics_get_memory_total(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
176
177
178/**
179 * Get the memory/free field of the given host_metrics.
180 */
181extern bool
182xen_host_metrics_get_memory_free(xen_session *session, int64_t *result, xen_host_metrics host_metrics);
183
184
185/**
186 * Get the last_updated field of the given host_metrics.
187 */
188extern bool
189xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics);
190
191
192/**
193 * Return a list of all the host_metrics instances known to the system.
194 */
195extern bool
196xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result);
197
198
199#endif
Note: See TracBrowser for help on using the repository browser.