aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xc/py
diff options
context:
space:
mode:
authormwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>2004-02-24 16:34:00 +0000
committermwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>2004-02-24 16:34:00 +0000
commita25f2798ee96c364e89903e247b935e31bb14188 (patch)
tree61b4c06183884baaf137e235b1fdc12b82aa12ea /tools/xc/py
parent6b15518ef7cfccac07a1be7bceed8c5b36f9a888 (diff)
downloadxen-a25f2798ee96c364e89903e247b935e31bb14188.tar.gz
xen-a25f2798ee96c364e89903e247b935e31bb14188.tar.bz2
xen-a25f2798ee96c364e89903e247b935e31bb14188.zip
bitkeeper revision 1.747 (403b7cf86JDQU8_ljAm9SqJGvsVF4w)
Physical hardware info dom0 op.
Diffstat (limited to 'tools/xc/py')
-rw-r--r--tools/xc/py/Xc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c
index e34764b23f..2376be5eae 100644
--- a/tools/xc/py/Xc.c
+++ b/tools/xc/py/Xc.c
@@ -788,6 +788,34 @@ static PyObject *pyxc_readconsolering(PyObject *self,
return PyString_FromStringAndSize(str, (ret < 0) ? 0 : ret);
}
+static PyObject *pyxc_physinfo(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+ PyObject *ret_obj;
+ int xc_ret;
+ xc_physinfo_t info;
+
+ xc_ret = xc_physinfo(xc->xc_handle, &info);
+
+ if(!xc_ret)
+ {
+ ret_obj = Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
+ "ht_per_core", info.ht_per_core,
+ "cores", info.cores,
+ "total_pages", info.total_pages,
+ "free_pages", info.free_pages,
+ "cpu_khz", info.cpu_khz);
+ }
+ else
+ {
+ ret_obj = Py_BuildValue(""); /* None */
+ }
+
+ return ret_obj;
+}
+
static PyMethodDef pyxc_methods[] = {
{ "domain_create",
(PyCFunction)pyxc_domain_create,
@@ -1010,6 +1038,13 @@ static PyMethodDef pyxc_methods[] = {
" clear [int, 0]: Bool - clear the ring after reading from it?\n\n"
"Returns: [str] string is empty on failure.\n" },
+ { "physinfo",
+ (PyCFunction)pyxc_physinfo,
+ METH_VARARGS, "\n"
+ "Get information about the physical host machine\n"
+ "Returns [dict]: information about the hardware"
+ " [None]: on failure.\n" },
+
{ NULL, NULL, 0, NULL }
};