debuggers.hg

changeset 22241:68cd8ae1b620

libxl: add current_memkb to libxl_dominfo

currently xcinfo2xlinfo reads tot_pages and uses that data to calculate
max_memkb, while tot_pages is the memory currently used by the domain
and max_pages is the theoretical maximum.
This patch calculates max_memkb from max_pages and introduces
current_memkb to store the current memory usage.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Stefano Stabellini <stefano.stabellini@eu.citrix.com>
date Wed Sep 22 17:23:22 2010 +0100 (2010-09-22)
parents e8e3aeed3eba
children 4f90c1fde133
files tools/libxl/libxl.c tools/libxl/libxl.idl tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Wed Sep 22 08:54:08 2010 +0100
     1.2 +++ b/tools/libxl/libxl.c	Wed Sep 22 17:23:22 2010 +0100
     1.3 @@ -558,7 +558,8 @@ static void xcinfo2xlinfo(const xc_domai
     1.4      else
     1.5          xlinfo->shutdown_reason  = ~0;
     1.6  
     1.7 -    xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
     1.8 +    xlinfo->current_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
     1.9 +    xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->max_pages);
    1.10      xlinfo->cpu_time = xcinfo->cpu_time;
    1.11      xlinfo->vcpu_max_id = xcinfo->max_vcpu_id;
    1.12      xlinfo->vcpu_online = xcinfo->nr_online_vcpus;
     2.1 --- a/tools/libxl/libxl.idl	Wed Sep 22 08:54:08 2010 +0100
     2.2 +++ b/tools/libxl/libxl.idl	Wed Sep 22 17:23:22 2010 +0100
     2.3 @@ -38,6 +38,7 @@ libxl_dominfo = Struct("dominfo",[
     2.4  
     2.5  Otherwise set to a value guaranteed not to clash with any valid
     2.6  SHUTDOWN_* constant."""),
     2.7 +    ("current_memkb",   uint64),
     2.8      ("max_memkb",   uint64),
     2.9      ("cpu_time",    uint64),
    2.10      ("vcpu_max_id", uint32),
     3.1 --- a/tools/libxl/xl_cmdimpl.c	Wed Sep 22 08:54:08 2010 +0100
     3.2 +++ b/tools/libxl/xl_cmdimpl.c	Wed Sep 22 17:23:22 2010 +0100
     3.3 @@ -2218,7 +2218,7 @@ static void list_domains(int verbose, co
     3.4          printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",
     3.5                  domname,
     3.6                  info[i].domid,
     3.7 -                (unsigned long) (info[i].max_memkb / 1024),
     3.8 +                (unsigned long) (info[i].current_memkb / 1024),
     3.9                  info[i].vcpu_online,
    3.10                  info[i].running ? 'r' : '-',
    3.11                  info[i].blocked ? 'b' : '-',