mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Add more version and capability reporting to Xen. Print the results with 'xm info'.
Signed-off-by: ian@xensource.com
This commit is contained in:
1 parent
73eac1082d
commit
45c67ab505
8 files changed
+118
-20
No files matched your search
@@ -690,6 +690,8 @@ static PyObject *pyxc_physinfo(PyObject *self,
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
xc_physinfo_t info;
|
||||
char cpu_cap[128], *p=cpu_cap, *q=cpu_cap;
|
||||
int i;
|
||||
|
||||
if ( !PyArg_ParseTuple(args, "") )
|
||||
return NULL;
|
||||
@@ -697,14 +699,25 @@ static PyObject *pyxc_physinfo(PyObject *self,
|
||||
if ( xc_physinfo(xc->xc_handle, &info) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
|
||||
*q=0;
|
||||
for(i=0;i<sizeof(info.hw_cap)/4;i++)
|
||||
{
|
||||
p+=sprintf(p,"%08x:",info.hw_cap[i]);
|
||||
if(info.hw_cap[i])
|
||||
q=p;
|
||||
}
|
||||
if(q>cpu_cap)
|
||||
*(q-1)=0;
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
|
||||
"threads_per_core", info.threads_per_core,
|
||||
"cores_per_socket", info.cores_per_socket,
|
||||
"sockets_per_node", info.sockets_per_node,
|
||||
"nr_nodes", info.nr_nodes,
|
||||
"total_pages", info.total_pages,
|
||||
"free_pages", info.free_pages,
|
||||
"cpu_khz", info.cpu_khz);
|
||||
"cpu_khz", info.cpu_khz,
|
||||
"hw_caps", cpu_cap);
|
||||
}
|
||||
|
||||
static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
@@ -715,7 +728,10 @@ static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
xen_extraversion_t xen_extra;
|
||||
xen_compile_info_t xen_cc;
|
||||
xen_changeset_info_t xen_chgset;
|
||||
xen_capabilities_info_t xen_caps;
|
||||
xen_parameters_info_t xen_parms;
|
||||
long xen_version;
|
||||
char str[128];
|
||||
|
||||
xen_version = xc_version(xc->xc_handle, XENVER_version, NULL);
|
||||
|
||||
@@ -728,10 +744,20 @@ static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
if ( xc_version(xc->xc_handle, XENVER_changeset, &xen_chgset) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
|
||||
if ( xc_version(xc->xc_handle, XENVER_capabilities, &xen_caps) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
if ( xc_version(xc->xc_handle, XENVER_parameters, &xen_parms) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
sprintf(str,"virt_start=0x%lx",xen_parms.virt_start);
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}",
|
||||
"xen_major", xen_version >> 16,
|
||||
"xen_minor", (xen_version & 0xffff),
|
||||
"xen_extra", xen_extra,
|
||||
"xen_caps", xen_caps.caps,
|
||||
"xen_params", str,
|
||||
"xen_changeset", xen_chgset,
|
||||
"cc_compiler", xen_cc.compiler,
|
||||
"cc_compile_by", xen_cc.compile_by,
|
||||
|
||||
@@ -58,20 +58,26 @@ class XendNode:
|
||||
|
||||
def physinfo(self):
|
||||
pinfo = self.xc.physinfo()
|
||||
info = [['cores_per_socket', pinfo['cores_per_socket']],
|
||||
info = [['nr_cpus', pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']],
|
||||
['nr_nodes', pinfo['nr_nodes']],
|
||||
['sockets_per_node', pinfo['sockets_per_node']],
|
||||
['cores_per_socket', pinfo['cores_per_socket']],
|
||||
['threads_per_core', pinfo['threads_per_core']],
|
||||
['cpu_mhz', pinfo['cpu_khz']/1000],
|
||||
['memory', pinfo['total_pages']/256],
|
||||
['free_memory', pinfo['free_pages']/256]]
|
||||
['cpu_mhz', pinfo['cpu_khz']/1000],
|
||||
['hw_caps', pinfo['hw_caps']],
|
||||
['memory', pinfo['total_pages']/256],
|
||||
['free_memory', pinfo['free_pages']/256]]
|
||||
return info
|
||||
|
||||
def xeninfo(self):
|
||||
xinfo = self.xc.xeninfo()
|
||||
return [['xen_major', xinfo['xen_major']],
|
||||
['xen_minor', xinfo['xen_minor']],
|
||||
['xen_extra', xinfo['xen_extra']],
|
||||
['xen_changeset', xinfo['xen_changeset']],
|
||||
['cc_compiler', xinfo['cc_compiler']],
|
||||
return [['xen_major', xinfo['xen_major']],
|
||||
['xen_minor', xinfo['xen_minor']],
|
||||
['xen_extra', xinfo['xen_extra']],
|
||||
['xen_caps', xinfo['xen_caps']],
|
||||
['xen_params',xinfo['xen_params']],
|
||||
['xen_changeset', xinfo['xen_changeset']],
|
||||
['cc_compiler', xinfo['cc_compiler']],
|
||||
['cc_compile_by', xinfo['cc_compile_by']],
|
||||
['cc_compile_domain', xinfo['cc_compile_domain']],
|
||||
['cc_compile_date', xinfo['cc_compile_date']]]
|
||||
|
||||