[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xentop: Add tmem-freeable info when tmem is active
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1259674698 0 # Node ID a006e510999130d5f6a7ad36e19e2d7d1b7486eb # Parent e6e3bf767d16bfbeb65fe6f9327f71cdf9f9a123 xentop: Add tmem-freeable info when tmem is active (No change to xentop output when tmem is inactive.) Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx> --- tools/libxc/xenctrl.h | 1 + tools/python/xen/xm/main.py | 2 +- tools/xenstat/libxenstat/src/xenstat.c | 9 +++++++++ tools/xenstat/libxenstat/src/xenstat.h | 3 +++ tools/xenstat/libxenstat/src/xenstat_priv.h | 1 + tools/xenstat/xentop/xentop.c | 13 ++++++++++--- 6 files changed, 25 insertions(+), 4 deletions(-) diff -r e6e3bf767d16 -r a006e5109991 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/libxc/xenctrl.h Tue Dec 01 13:38:18 2009 +0000 @@ -32,6 +32,7 @@ #include <xen/xsm/acm.h> #include <xen/xsm/acm_ops.h> #include <xen/xsm/flask_op.h> +#include <xen/tmem.h> #if defined(__i386__) || defined(__x86_64__) #include <xen/foreign/x86_32.h> diff -r e6e3bf767d16 -r a006e5109991 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/python/xen/xm/main.py Tue Dec 01 13:38:18 2009 +0000 @@ -220,7 +220,7 @@ SUBCOMMAND_HELP = { 'tmem-set' : ('[<Domain>|-a|--all] [weight=<weight>] [cap=<cap>] ' '[compress=<compress>]', 'Change tmem settings.'), - 'tmem-freeable' : ('', 'Print number of freeable tmem pages.'), + 'tmem-freeable' : ('', 'Print freeable tmem (in MiB).'), 'tmem-shared-auth' : ('[<Domain>|-a|--all] [--uuid=<uuid>] [--auth=<0|1>]', 'De/authenticate shared tmem pool.'), # security diff -r e6e3bf767d16 -r a006e5109991 tools/xenstat/libxenstat/src/xenstat.c --- a/tools/xenstat/libxenstat/src/xenstat.c Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/xenstat/libxenstat/src/xenstat.c Tue Dec 01 13:38:18 2009 +0000 @@ -154,12 +154,16 @@ xenstat_node *xenstat_get_node(xenstat_h return NULL; } + node->cpu_hz = ((unsigned long long)physinfo.cpu_khz) * 1000ULL; node->num_cpus = physinfo.nr_cpus; node->tot_mem = ((unsigned long long)physinfo.total_pages) * handle->page_size; node->free_mem = ((unsigned long long)physinfo.free_pages) * handle->page_size; + + node->freeable_mb = (long)xc_tmem_control(handle->xc_handle, -1, + TMEMC_QUERY_FREEABLE_MB, -1, 0, 0, 0, NULL); /* malloc(0) is not portable, so allocate a single domain. This will * be resized below. */ @@ -304,6 +308,11 @@ unsigned long long xenstat_node_free_mem return node->free_mem; } +long xenstat_node_freeable_mb(xenstat_node * node) +{ + return node->freeable_mb; +} + unsigned int xenstat_node_num_domains(xenstat_node * node) { return node->num_domains; diff -r e6e3bf767d16 -r a006e5109991 tools/xenstat/libxenstat/src/xenstat.h --- a/tools/xenstat/libxenstat/src/xenstat.h Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/xenstat/libxenstat/src/xenstat.h Tue Dec 01 13:38:18 2009 +0000 @@ -69,6 +69,9 @@ unsigned long long xenstat_node_tot_mem( /* Get amount of free memory on a node */ unsigned long long xenstat_node_free_mem(xenstat_node * node); +/* Get amount of tmem freeable memory (in MiB) on a node */ +long xenstat_node_freeable_mb(xenstat_node * node); + /* Find the number of domains existing on a node */ unsigned int xenstat_node_num_domains(xenstat_node * node); diff -r e6e3bf767d16 -r a006e5109991 tools/xenstat/libxenstat/src/xenstat_priv.h --- a/tools/xenstat/libxenstat/src/xenstat_priv.h Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/xenstat/libxenstat/src/xenstat_priv.h Tue Dec 01 13:38:18 2009 +0000 @@ -49,6 +49,7 @@ struct xenstat_node { unsigned long long free_mem; unsigned int num_domains; xenstat_domain *domains; /* Array of length num_domains */ + long freeable_mb; }; struct xenstat_domain { diff -r e6e3bf767d16 -r a006e5109991 tools/xenstat/xentop/xentop.c --- a/tools/xenstat/xentop/xentop.c Tue Dec 01 13:37:20 2009 +0000 +++ b/tools/xenstat/xentop/xentop.c Tue Dec 01 13:38:18 2009 +0000 @@ -799,6 +799,7 @@ void do_summary(void) crash = 0, dying = 0, shutdown = 0; unsigned i, num_domains = 0; unsigned long long used = 0; + long freeable_mb = 0; xenstat_domain *domain; time_t curt; @@ -825,12 +826,18 @@ void do_summary(void) num_domains, run, block, pause, crash, dying, shutdown); used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node); + freeable_mb = xenstat_node_freeable_mb(cur_node); /* Dump node memory and cpu information */ - print("Mem: %lluk total, %lluk used, %lluk free " - "CPUs: %u @ %lluMHz\n", + if ( freeable_mb <= 0 ) + print("Mem: %lluk total, %lluk used, %lluk free ", xenstat_node_tot_mem(cur_node)/1024, used/1024, - xenstat_node_free_mem(cur_node)/1024, + xenstat_node_free_mem(cur_node)/1024); + else + print("Mem: %lluk total, %lluk used, %lluk free, %ldk freeable, ", + xenstat_node_tot_mem(cur_node)/1024, used/1024, + xenstat_node_free_mem(cur_node)/1024, freeable_mb*1024); + print("CPUs: %u @ %lluMHz\n", xenstat_node_num_cpus(cur_node), xenstat_node_cpu_hz(cur_node)/1000000); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |