diff options
author | jeroney@localhost.localdomain <jeroney@localhost.localdomain> | 2005-10-27 10:19:58 +0100 |
---|---|---|
committer | jeroney@localhost.localdomain <jeroney@localhost.localdomain> | 2005-10-27 10:19:58 +0100 |
commit | 740401a4f848c64541f892b224d32aec56ac6946 (patch) | |
tree | 2d87f69365e7a22b0edebd898bef5d0e6ebf4d0d /tools/xenstat/xentop | |
parent | 6ee89dae792ca89399753492cac801110352f608 (diff) | |
download | xen-740401a4f848c64541f892b224d32aec56ac6946.tar.gz xen-740401a4f848c64541f892b224d32aec56ac6946.tar.bz2 xen-740401a4f848c64541f892b224d32aec56ac6946.zip |
* Enable xenstat to use xenstore
* Have xentop display names instead of DomIDs
as requested in Bugzilla#311 filed by Ian
Diffstat (limited to 'tools/xenstat/xentop')
-rw-r--r-- | tools/xenstat/xentop/Makefile | 2 | ||||
-rw-r--r-- | tools/xenstat/xentop/xentop.c | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/tools/xenstat/xentop/Makefile b/tools/xenstat/xentop/Makefile index 633fd57064..2115e6f3cf 100644 --- a/tools/xenstat/xentop/Makefile +++ b/tools/xenstat/xentop/Makefile @@ -26,7 +26,7 @@ mandir=$(prefix)/share/man man1dir=$(mandir)/man1 sbindir=$(prefix)/sbin -CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT) +CFLAGS += -DGCC_PRINTF -Wall -I$(XEN_LIBXENSTAT) LDFLAGS += -L$(XEN_LIBXENSTAT) LDLIBS += -lxenstat -lncurses diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c index 1cb5e36829..286b037051 100644 --- a/tools/xenstat/xentop/xentop.c +++ b/tools/xenstat/xentop/xentop.c @@ -28,6 +28,7 @@ #include <time.h> #include <unistd.h> +#include <xs.h> #include <xenstat.h> #define XENTOP_VERSION "1.0" @@ -91,6 +92,8 @@ static int compare_net_rx(xenstat_domain *domain1, xenstat_domain *domain2); static void print_net_rx(xenstat_domain *domain); static int compare_ssid(xenstat_domain *domain1, xenstat_domain *domain2); static void print_ssid(xenstat_domain *domain); +static int compare_name(xenstat_domain *domain1, xenstat_domain *domain2); +static void print_name(xenstat_domain *domain); /* Section printing functions */ static void do_summary(void); @@ -104,6 +107,7 @@ static void top(void); /* Field types */ typedef enum field_id { FIELD_DOMID, + FIELD_NAME, FIELD_STATE, FIELD_CPU, FIELD_CPU_PCT, @@ -127,7 +131,8 @@ typedef struct field { } field; field fields[] = { - { FIELD_DOMID, "DOMID", 5, compare_domid, print_domid }, +// { FIELD_DOMID, "DOMID", 5, compare_domid, print_domid }, + { FIELD_NAME, "NAME", 10, compare_name, print_name }, { FIELD_STATE, "STATE", 6, compare_state, print_state }, { FIELD_CPU, "CPU(sec)", 10, compare_cpu, print_cpu }, { FIELD_CPU_PCT, "CPU(%)", 6, compare_cpu_pct, print_cpu_pct }, @@ -356,6 +361,18 @@ void print_domid(xenstat_domain *domain) print("%5u", xenstat_domain_id(domain)); } +/* Compare domain names, returning -1,0,1 for <,=,> */ +int compare_name(xenstat_domain *domain1, xenstat_domain *domain2) +{ + return strcasecmp(xenstat_domain_name(domain1), xenstat_domain_name(domain2)); +} + +/* Prints domain name */ +void print_name(xenstat_domain *domain) +{ + print("%10s", xenstat_domain_name(domain)); +} + struct { unsigned int (*get)(xenstat_domain *); char ch; |