Mailing List Archive

[PATCH 11 of 18] Tools: Allow libxl/xl to expose the total number of shared frames and space saved
tools/libxl/Makefile | 2 +-
tools/libxl/xl_cmdimpl.c | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)


Signed-off-by: Adin Scannell <adin@scannell.ca>

diff -r 6f489a294a76 -r cde3529132c1 tools/libxl/Makefile
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -89,7 +89,7 @@ libxl_internal.h: _libxl_types_internal.
libxl_internal_json.h: _libxl_types_internal_json.h

$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
-$(LIBXL_OBJS): libxl_internal.h
+$(LIBXL_OBJS) $(XL_OBJS): libxl_internal.h

_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_json.h __libxl_type$*.c
diff -r 6f489a294a76 -r cde3529132c1 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -38,6 +38,7 @@

#include "libxl.h"
#include "libxl_utils.h"
+#include "libxl_internal.h"
#include "libxlutil.h"
#include "xl.h"

@@ -3758,6 +3759,7 @@ int main_info(int argc, char **argv)
static void sharing(int totals, const libxl_dominfo *info, int nb_domain)
{
int i;
+ const libxl_version_info *vinfo;

printf("Name ID Mem Shared\n");

@@ -3774,9 +3776,14 @@ static void sharing(int totals, const li
free(domname);
}

- if (totals)
- {
- /* To be added with a future patch. */
+ if (totals) {
+ vinfo = libxl_get_version_info(ctx);
+ if (vinfo) {
+ i = (1 << 20) / vinfo->pagesize;
+ printf("Freed with sharing: %ld Total physical shared: %ld\n",
+ xc_sharing_freed_pages(ctx->xch) / i,
+ xc_sharing_used_frames(ctx->xch) / i);
+ }
}
}


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 11 of 18] Tools: Allow libxl/xl to expose the total number of shared frames and space saved [ In reply to ]
Andres Lagar-Cavilla writes ("[PATCH 11 of 18] Tools: Allow libxl/xl to expose the total number of shared frames and space saved"):
> diff -r 6f489a294a76 -r cde3529132c1 tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -38,6 +38,7 @@
>
> #include "libxl.h"
> #include "libxl_utils.h"
> +#include "libxl_internal.h"

No, this is not correct. xl should not include libxl_internal.h. Nor
should it make libxc calls directly.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel