From: Dario Faggioli Subject: [PATCH 08 of 11] xl: add more NUMA information to `xl info -n' Date: Thu, 31 May 2012 14:11:13 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Andre Przywara , Ian Campbell , Stefano Stabellini , George Dunlap , Juergen Gross , Ian Jackson List-Id: xen-devel@lists.xenproject.org So that the user knows how much memory there is on each node and how far they are from each others. Signed-off-by: Dario Faggioli diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4217,6 +4217,36 @@ static void output_physinfo(void) return; } +static void output_numainfo(void) +{ + libxl_numainfo *info; + int i, j, nr; + + info = libxl_get_numainfo(ctx, &nr); + if (info == NULL) { + fprintf(stderr, "libxl_get_numainfo failed.\n"); + return; + } + + printf("numa_info :\n"); + printf("node: memsize memfree distances\n"); + + for (i = 0; i < nr; i++) { + if (info[i].size != LIBXL_NUMAINFO_INVALID_ENTRY) { + printf("%4d: %6"PRIu64" %6"PRIu64" %d", i, + info[i].size / (1 << 20), info[i].free / (1 << 20), + info[i].dists[0]); + for (j = 1; j < info[i].num_dists; j++) + printf(",%d", info[i].dists[j]); + printf("\n"); + } + } + + libxl_numainfo_list_free(info, nr); + + return; +} + static void output_topologyinfo(void) { libxl_cputopology *info; @@ -4239,8 +4269,6 @@ static void output_topologyinfo(void) libxl_cputopology_list_free(info, nr); - printf("numa_info : none\n"); - return; } @@ -4250,8 +4278,10 @@ static void info(int numa) output_physinfo(); - if (numa) + if (numa) { output_topologyinfo(); + output_numainfo(); + } output_xeninfo();