WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] fix/improve xentop -b

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] fix/improve xentop -b
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: Tue, 12 Jun 2007 20:19:10 +0100
Delivery-date: Tue, 12 Jun 2007 12:17:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] fix/improve xentop -b, John Levon <=