[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 6 of 8] Tools: Allow libxl/xl to expose the total number of shared frames and space saved



 tools/libxl/libxl.c      |  10 ++++++++++
 tools/libxl/libxl.h      |   3 +++
 tools/libxl/xl_cmdimpl.c |  12 +++++++++---
 3 files changed, 22 insertions(+), 3 deletions(-)


Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Signed-off-by: Adin Scannell <adin@xxxxxxxxxxx>

diff -r 6e8b8fb2c8b2 -r 3fc7875c8d98 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -499,6 +499,16 @@ int libxl_domain_pause(libxl_ctx *ctx, u
     return 0;
 }
 
+long libxl_sharing_used_frames(libxl_ctx *ctx)
+{
+    return xc_sharing_used_frames(ctx->xch);
+}
+
+long libxl_sharing_freed_pages(libxl_ctx *ctx)
+{
+    return xc_sharing_freed_pages(ctx->xch);
+}
+
 int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid,
                            const char *filename)
 {
diff -r 6e8b8fb2c8b2 -r 3fc7875c8d98 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -350,6 +350,9 @@ int libxl_domain_rename(libxl_ctx *ctx, 
 int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid);
 int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid);
 
+long libxl_sharing_used_frames(libxl_ctx *ctx);
+long libxl_sharing_freed_pages(libxl_ctx *ctx);
+
 int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, const char 
*filename);
 
 int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t 
target_memkb);
diff -r 6e8b8fb2c8b2 -r 3fc7875c8d98 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3758,6 +3758,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 +3775,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", 
+            libxl_sharing_freed_pages(ctx) / i,
+            libxl_sharing_used_frames(ctx) / i);
+        }
     }
 }
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.