[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 7/8] tools/libxl: introduce libxl_count_physical_sockets
On Thu, Mar 26, 2015 at 08:38:24PM +0800, Chao Peng wrote: > Introduce a util function libxl_count_physical_sockets() to get physical > socket count. Replaced CMT code with the new function in xl. > > Signed-off-by: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx> > --- > tools/libxl/libxl_utils.c | 17 +++++++++++++++++ > tools/libxl/libxl_utils.h | 2 ++ > tools/libxl/xl_cmdimpl.c | 11 +++-------- > 3 files changed, 22 insertions(+), 8 deletions(-) > > diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c > index 9053b27..6dbc611 100644 > --- a/tools/libxl/libxl_utils.c > +++ b/tools/libxl/libxl_utils.c > @@ -853,6 +853,23 @@ int libxl_get_online_cpus(libxl_ctx *ctx) > return online_cpus < 0 ? ERROR_FAIL : online_cpus; > } > > +uint32_t libxl_count_physical_sockets(libxl_ctx *ctx) > +{ > + int rc; > + libxl_physinfo info; > + uint32_t nr_sockets = 0; > + > + libxl_physinfo_init(&info); > + > + rc = libxl_get_physinfo(ctx, &info); > + if (!rc) > + nr_sockets = info.nr_cpus / info.threads_per_core > + / info.cores_per_socket; > + > + libxl_physinfo_dispose(&info); > + return nr_sockets; > +} > + This function looks x86 centric. If I'm right then it should be surrounded by #ifdef. I think Ian suggested you make this an internal function not a public API. But if I misunderstand Ian's intention, please make this function return libxl error code. The socket number can be returned from an out parameter. I.e. int libxl_count_physical_sockets(libxl_ctx *ctx, uint32_t *nr_sockets); Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |