All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: ian.jackson@citrix.com, andres@gridcentric.ca, tim@xen.org,
	ian.campbell@citrix.com, adin@gridcentric.ca
Subject: [PATCH 6 of 8] Tools: Allow libxl/xl to expose the total number of shared frames and space saved
Date: Fri, 09 Dec 2011 18:15:56 -0500	[thread overview]
Message-ID: <3fc7875c8d98cbc74598.1323472556@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1323472550@xdev.gridcentric.ca>

 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@lagarcavilla.org>
Signed-off-by: Adin Scannell <adin@scannell.ca>

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);
+        }
     }
 }

  parent reply	other threads:[~2011-12-09 23:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 23:15 [PATCH 0 of 8] Tools: Memory sharing interface updates Andres Lagar-Cavilla
2011-12-09 23:15 ` [PATCH 1 of 8] Tools: Do not assume sharing target is dom0 in libxc wrappers Andres Lagar-Cavilla
2011-12-12  9:50   ` Ian Campbell
2011-12-09 23:15 ` [PATCH 2 of 8] Tools: Update libxc mem sharing interface Andres Lagar-Cavilla
2011-12-12  9:56   ` Ian Campbell
2011-12-09 23:15 ` [PATCH 3 of 8] Tools: Update memshr tool to use new sharing API Andres Lagar-Cavilla
2011-12-12 10:13   ` Ian Campbell
2011-12-13  4:18     ` Andres Lagar-Cavilla
2011-12-12 12:14   ` Ian Jackson
2011-12-09 23:15 ` [PATCH 4 of 8] Tools: Add a sharing command to xl for information about shared pages Andres Lagar-Cavilla
2011-12-12 10:26   ` Ian Campbell
2011-12-09 23:15 ` [PATCH 5 of 8] Tools: Expose to libxc the total number of shared frames and space saved Andres Lagar-Cavilla
2011-12-12 10:39   ` Ian Campbell
2011-12-13  3:43     ` Andres Lagar-Cavilla
2011-12-13 17:08       ` Adin Scannell
2011-12-14 10:47         ` Ian Campbell
2011-12-09 23:15 ` Andres Lagar-Cavilla [this message]
2011-12-12 10:43   ` [PATCH 6 of 8] Tools: Allow libxl/xl to expose " Ian Campbell
2011-12-13 17:13     ` Adin Scannell
2011-12-09 23:15 ` [PATCH 7 of 8] Tools: Libxc wrappers to add shared pages to physmap Andres Lagar-Cavilla
2011-12-12 10:48   ` Ian Campbell
2011-12-12 10:50   ` Ian Campbell
2011-12-09 23:15 ` [PATCH 8 of 8] Tools: Libxc wrapper for the new sharing audit domctl Andres Lagar-Cavilla
2011-12-12 10:52   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3fc7875c8d98cbc74598.1323472556@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.