source: trunk/packages/xen-common/xen-common/tools/xenstat/libxenstat/src/xenstat.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: 6.4 KB
Line 
1/* libxenstat: statistics-collection library for Xen
2 * Copyright (C) International Business Machines Corp., 2005
3 * Authors: Josh Triplett <josht@us.ibm.com>
4 *          Judy Fischbach <jfisch@us.ibm.com>
5 *          David Hendricks <dhendrix@us.ibm.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 */
17
18/* libxenstat API */
19
20#ifndef XENSTAT_H
21#define XENSTAT_H
22
23/* Opaque handles */
24typedef struct xenstat_handle xenstat_handle;
25typedef struct xenstat_domain xenstat_domain;
26typedef struct xenstat_node xenstat_node;
27typedef struct xenstat_vcpu xenstat_vcpu;
28typedef struct xenstat_network xenstat_network;
29typedef struct xenstat_vbd xenstat_vbd;
30
31/* Initialize the xenstat library.  Returns a handle to be used with
32 * subsequent calls to the xenstat library, or NULL if an error occurs. */
33xenstat_handle *xenstat_init(void);
34
35/* Release the handle to libxc, free resources, etc. */
36void xenstat_uninit(xenstat_handle * handle);
37
38/* Flags for types of information to collect in xenstat_get_node */
39#define XENSTAT_VCPU 0x1
40#define XENSTAT_NETWORK 0x2
41#define XENSTAT_XEN_VERSION 0x4
42#define XENSTAT_VBD 0x8
43#define XENSTAT_ALL (XENSTAT_VCPU|XENSTAT_NETWORK|XENSTAT_XEN_VERSION|XENSTAT_VBD)
44
45/* Get all available information about a node */
46xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags);
47
48/* Free the information */
49void xenstat_free_node(xenstat_node * node);
50
51/*
52 * Node functions - extract information from a xenstat_node
53 */
54
55/* Get information about the domain with the given domain ID */
56xenstat_domain *xenstat_node_domain(xenstat_node * node,
57                                    unsigned int domid);
58
59/* Get the domain with the given index; used to loop over all domains. */
60xenstat_domain *xenstat_node_domain_by_index(xenstat_node * node,
61                                             unsigned index);
62
63/* Get xen version of the node */
64const char *xenstat_node_xen_version(xenstat_node * node);
65
66/* Get amount of total memory on a node */
67unsigned long long xenstat_node_tot_mem(xenstat_node * node);
68
69/* Get amount of free memory on a node */
70unsigned long long xenstat_node_free_mem(xenstat_node * node);
71
72/* Find the number of domains existing on a node */
73unsigned int xenstat_node_num_domains(xenstat_node * node);
74
75/* Find the number of CPUs existing on a node */
76unsigned int xenstat_node_num_cpus(xenstat_node * node);
77
78/* Get information about the CPU speed */
79unsigned long long xenstat_node_cpu_hz(xenstat_node * node);
80
81/*
82 * Domain functions - extract information from a xenstat_domain
83 */
84
85/* Get the domain ID for this domain */
86unsigned xenstat_domain_id(xenstat_domain * domain);
87
88/* Set the domain name for the domain */
89char *xenstat_domain_name(xenstat_domain * domain);
90
91/* Get information about how much CPU time has been used */
92unsigned long long xenstat_domain_cpu_ns(xenstat_domain * domain);
93
94/* Find the number of VCPUs allocated to a domain */
95unsigned int xenstat_domain_num_vcpus(xenstat_domain * domain);
96
97/* Get the VCPU handle to obtain VCPU stats */
98xenstat_vcpu *xenstat_domain_vcpu(xenstat_domain * domain,
99                                  unsigned int vcpu);
100
101/* Find the current memory reservation for this domain */
102unsigned long long xenstat_domain_cur_mem(xenstat_domain * domain);
103
104/* Find the maximum memory reservation for this domain */
105unsigned long long xenstat_domain_max_mem(xenstat_domain * domain);
106
107/* Find the domain's SSID */
108unsigned int xenstat_domain_ssid(xenstat_domain * domain);
109
110/* Get domain states */
111unsigned int xenstat_domain_dying(xenstat_domain * domain);
112unsigned int xenstat_domain_crashed(xenstat_domain * domain);
113unsigned int xenstat_domain_shutdown(xenstat_domain * domain);
114unsigned int xenstat_domain_paused(xenstat_domain * domain);
115unsigned int xenstat_domain_blocked(xenstat_domain * domain);
116unsigned int xenstat_domain_running(xenstat_domain * domain);
117
118/* Get the number of networks for a given domain */
119unsigned int xenstat_domain_num_networks(xenstat_domain *);
120
121/* Get the network handle to obtain network stats */
122xenstat_network *xenstat_domain_network(xenstat_domain * domain,
123                                        unsigned int network);
124
125/* Get the number of VBDs for a given domain */
126unsigned int xenstat_domain_num_vbds(xenstat_domain *);
127
128/* Get the VBD handle to obtain VBD stats */
129xenstat_vbd *xenstat_domain_vbd(xenstat_domain * domain,
130                                    unsigned int vbd);
131
132/*
133 * VCPU functions - extract information from a xenstat_vcpu
134 */
135
136/* Get VCPU usage */
137unsigned int xenstat_vcpu_online(xenstat_vcpu * vcpu);
138unsigned long long xenstat_vcpu_ns(xenstat_vcpu * vcpu);
139
140
141/*
142 * Network functions - extract information from a xenstat_network
143 */
144
145/* Get the ID for this network */
146unsigned int xenstat_network_id(xenstat_network * network);
147
148/* Get the number of receive bytes for this network */
149unsigned long long xenstat_network_rbytes(xenstat_network * network);
150
151/* Get the number of receive packets for this network */
152unsigned long long xenstat_network_rpackets(xenstat_network * network);
153
154/* Get the number of receive errors for this network */
155unsigned long long xenstat_network_rerrs(xenstat_network * network);
156
157/* Get the number of receive drops for this network */
158unsigned long long xenstat_network_rdrop(xenstat_network * network);
159
160/* Get the number of transmit bytes for this network */
161unsigned long long xenstat_network_tbytes(xenstat_network * network);
162
163/* Get the number of transmit packets for this network */
164unsigned long long xenstat_network_tpackets(xenstat_network * network);
165
166/* Get the number of transmit errors for this network */
167unsigned long long xenstat_network_terrs(xenstat_network * network);
168
169/* Get the number of transmit drops for this network */
170unsigned long long xenstat_network_tdrop(xenstat_network * network);
171
172/*
173 * VBD functions - extract information from a xen_vbd
174 */
175/* Get the device number for Virtual Block Device */
176unsigned int xenstat_vbd_dev(xenstat_vbd * vbd);
177
178/* Get the number of OO/RD/WR requests for vbd */
179unsigned long long xenstat_vbd_oo_reqs(xenstat_vbd * vbd);
180unsigned long long xenstat_vbd_rd_reqs(xenstat_vbd * vbd);
181unsigned long long xenstat_vbd_wr_reqs(xenstat_vbd * vbd);
182
183#endif /* XENSTAT_H */
Note: See TracBrowser for help on using the repository browser.