# HG changeset patch
# User john.levon@xxxxxxx
# Date 1181675717 25200
# Node ID 84fdc4b2d635ab703e1819ca0d3b9862c006c769
# Parent d036693748c8efa7eec5a09bbf179308056f8e93
xentop -b option should work
Some curses libraries don't work with xentop in batch mode, avoid those calls.
Avoid the over-verbose summary lines when batch mode is requested.
Signed-off-by: Gary Pennington <gary.pennington@xxxxxxx>
diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -782,25 +782,28 @@ void do_header(void)
field_id i;
/* Turn on REVERSE highlight attribute for headings */
- attron(A_REVERSE);
+ if (!batch)
+ attron(A_REVERSE);
for(i = 0; i < NUM_FIELDS; i++) {
if(i != 0)
print(" ");
/* The BOLD attribute is turned on for the sort column */
- if(i == sort_field)
+ if(!batch && i == sort_field)
attron(A_BOLD);
print("%*s", fields[i].default_width, fields[i].header);
- if(i == sort_field)
+ if(!batch && i == sort_field)
attroff(A_BOLD);
}
- attroff(A_REVERSE);
+ if (!batch)
+ attroff(A_REVERSE);
print("\n");
}
/* Displays bottom status line or current prompt */
void do_bottom_line(void)
{
- move(lines()-1, 2);
+ if (!batch)
+ move(lines()-1, 2);
if (prompt != NULL) {
printw("%s: %s", prompt, prompt_val);
@@ -843,10 +846,10 @@ void do_domain(xenstat_domain *domain)
for(i = 0; i < NUM_FIELDS; i++) {
if(i != 0)
print(" ");
- if(i == sort_field)
+ if(!batch && i == sort_field)
attron(A_BOLD);
fields[i].print(domain);
- if(i == sort_field)
+ if(!batch && i == sort_field)
attroff(A_BOLD);
}
print("\n");
@@ -958,7 +961,8 @@ static void top(void)
fail("Failed to retrieve statistics from libxenstat\n");
/* dump summary top information */
- do_summary();
+ if (!batch)
+ do_summary();
/* Count the number of domains for which to report data */
num_domains = xenstat_node_num_domains(cur_node);
@@ -978,7 +982,7 @@ static void top(void)
first_domain_index = num_domains-1;
for (i = first_domain_index; i < num_domains; i++) {
- if(current_row() == lines()-1)
+ if(!batch && current_row() == lines()-1)
break;
if (i == first_domain_index || repeat_header)
do_header();
@@ -992,7 +996,7 @@ static void top(void)
}
if(!batch)
- do_bottom_line();
+ do_bottom_line();
free(domains);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|