Mailing List Archive

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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 6 of 8] Tools: Allow libxl/xl to expose the total number of shared frames and space saved [ In reply to ]
On Fri, 2011-12-09 at 23:15 +0000, Andres Lagar-Cavilla wrote:
> 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);

I'm undecided but perhaps it would be appropriate to add these to
libxl_physinfo? In which case the output of "xl physinfo" or "xl info"
would be a nice home for these. Or perhaps a new meminfo or hostinfo
struct?

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH 6 of 8] Tools: Allow libxl/xl to expose the total number of shared frames and space saved [ In reply to ]
On Mon, Dec 12, 2011 at 5:43 AM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Fri, 2011-12-09 at 23:15 +0000, Andres Lagar-Cavilla wrote:
>> 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);
>
> I'm undecided but perhaps it would be appropriate to add these to
> libxl_physinfo? In which case the output of "xl physinfo" or "xl info"
> would be a nice home for these. Or perhaps a new meminfo or hostinfo
> struct?

Sure, libxl_physinfo makes sense.

Cheers!
-Adin

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