>From e48a447d505036089c1544cde2ab9648eabf595c Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 8 Apr 2014 11:07:36 -0400 Subject: [PATCH 2/2] xentop: When running with -R don't output everything. Signed-off-by: Konrad Rzeszutek Wilk --- tools/xenstat/xentop/xentop.c | 49 ++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c index 88433e9..b6a1797 100644 --- a/tools/xenstat/xentop/xentop.c +++ b/tools/xenstat/xentop/xentop.c @@ -179,31 +179,32 @@ typedef struct field { unsigned int default_on; int (*compare)(xenstat_domain *domain1, xenstat_domain *domain2); void (*print)(xenstat_domain *domain); + unsigned int optional; } field; field fields[] = { - { FIELD_NAME, "NAME", 10, 1, compare_name, print_name }, - { FIELD_STATE, "STATE", 6, 1, compare_state, print_state }, - { FIELD_CPU, "CPU(sec)", 10, 1, compare_cpu, print_cpu }, - { FIELD_CPU_PCT, "CPU(%)", 6, 1, compare_cpu_pct, print_cpu_pct }, - { FIELD_CPU_OFFLINE_PCT, "CPU_O(%)", 6, 0, compare_cpu_offline_pct, print_cpu_offline_pct }, - { FIELD_CPU_BLOCKED_PCT, "CPU_B(%)", 6, 0, compare_cpu_blocked_pct, print_cpu_blocked_pct }, - { FIELD_CPU_RUNNABLE_PCT, "CPU_R(%)", 6, 0, compare_cpu_runnable_pct, print_cpu_runnable_pct }, - { FIELD_MEM, "MEM(k)", 10, 1, compare_mem, print_mem }, - { FIELD_MEM_PCT, "MEM(%)", 6, 1, compare_mem, print_mem_pct }, - { FIELD_MAXMEM, "MAXMEM(k)", 10, 1, compare_maxmem, print_maxmem }, - { FIELD_MAX_PCT, "MAXMEM(%)", 9, 1, compare_maxmem, print_max_pct }, - { FIELD_VCPUS, "VCPUS", 5, 1, compare_vcpus, print_vcpus }, - { FIELD_NETS, "NETS", 4, 1, compare_nets, print_nets }, - { FIELD_NET_TX, "NETTX(k)", 8, 1, compare_net_tx, print_net_tx }, - { FIELD_NET_RX, "NETRX(k)", 8, 1, compare_net_rx, print_net_rx }, - { FIELD_VBDS, "VBDS", 4, 1, compare_vbds, print_vbds }, - { FIELD_VBD_OO, "VBD_OO", 8, 1, compare_vbd_oo, print_vbd_oo }, - { FIELD_VBD_RD, "VBD_RD", 8, 1, compare_vbd_rd, print_vbd_rd }, - { FIELD_VBD_WR, "VBD_WR", 8, 1, compare_vbd_wr, print_vbd_wr }, - { FIELD_VBD_RSECT, "VBD_RSECT", 10, 1, compare_vbd_rsect, print_vbd_rsect }, - { FIELD_VBD_WSECT, "VBD_WSECT", 10, 1, compare_vbd_wsect, print_vbd_wsect }, - { FIELD_SSID, "SSID", 4, 1, compare_ssid, print_ssid } + { FIELD_NAME, "NAME", 10, 1, compare_name, print_name , 0}, + { FIELD_STATE, "STATE", 6, 1, compare_state, print_state , 0}, + { FIELD_CPU, "CPU(sec)", 10, 1, compare_cpu, print_cpu , 0}, + { FIELD_CPU_PCT, "CPU(%)", 6, 1, compare_cpu_pct, print_cpu_pct , 0}, + { FIELD_CPU_OFFLINE_PCT, "CPU_O(%)", 6, 0, compare_cpu_offline_pct, print_cpu_offline_pct , 0}, + { FIELD_CPU_BLOCKED_PCT, "CPU_B(%)", 6, 0, compare_cpu_blocked_pct, print_cpu_blocked_pct , 0}, + { FIELD_CPU_RUNNABLE_PCT, "CPU_R(%)", 6, 0, compare_cpu_runnable_pct, print_cpu_runnable_pct , 0}, + { FIELD_MEM, "MEM(k)", 10, 1, compare_mem, print_mem , 1}, + { FIELD_MEM_PCT, "MEM(%)", 6, 1, compare_mem, print_mem_pct , 1}, + { FIELD_MAXMEM, "MAXMEM(k)", 10, 1, compare_maxmem, print_maxmem , 1}, + { FIELD_MAX_PCT, "MAXMEM(%)", 9, 1, compare_maxmem, print_max_pct , 1}, + { FIELD_VCPUS, "VCPUS", 5, 1, compare_vcpus, print_vcpus , 0}, + { FIELD_NETS, "NETS", 4, 1, compare_nets, print_nets , 1}, + { FIELD_NET_TX, "NETTX(k)", 8, 1, compare_net_tx, print_net_tx , 1}, + { FIELD_NET_RX, "NETRX(k)", 8, 1, compare_net_rx, print_net_rx , 1}, + { FIELD_VBDS, "VBDS", 4, 1, compare_vbds, print_vbds , 1}, + { FIELD_VBD_OO, "VBD_OO", 8, 1, compare_vbd_oo, print_vbd_oo , 1}, + { FIELD_VBD_RD, "VBD_RD", 8, 1, compare_vbd_rd, print_vbd_rd , 1}, + { FIELD_VBD_WR, "VBD_WR", 8, 1, compare_vbd_wr, print_vbd_wr , 1}, + { FIELD_VBD_RSECT, "VBD_RSECT", 10, 1, compare_vbd_rsect, print_vbd_rsect , 1}, + { FIELD_VBD_WSECT, "VBD_WSECT", 10, 1, compare_vbd_wsect, print_vbd_wsect , 1}, + { FIELD_SSID, "SSID", 4, 1, compare_ssid, print_ssid , 1} }; const unsigned int NUM_FIELDS = sizeof(fields)/sizeof(field); @@ -944,6 +945,8 @@ void do_header(void) print(" "); if (!fields[i].default_on && !show_runnable) continue; + if (fields[i].optional && show_runnable) + continue; /* The BOLD attribute is turned on for the sort column */ if (i == sort_field) xentop_attron(A_BOLD); @@ -1008,6 +1011,8 @@ void do_domain(xenstat_domain *domain) print(" "); if (!fields[i].default_on && !show_runnable) continue; + if (fields[i].optional && show_runnable) + continue; if (i == sort_field) xentop_attron(A_BOLD); fields[i].print(domain); -- 2.4.3