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-changelog

[Xen-changelog] [xen-unstable] xentop: Fix -b option (batch mode).

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xentop: Fix -b option (batch mode).
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Jun 2007 12:57:52 -0700
Delivery-date: Thu, 14 Jun 2007 15:25:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1181729591 -3600
# Node ID 30449e0e0a64618c29e47ed7774cd2b689711319
# Parent  c484106e44bd89a1f9eb2c457a4ed5acae2c7ff7
xentop: Fix -b option (batch mode).

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>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/xenstat/xentop/xentop.c |   53 ++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff -r c484106e44bd -r 30449e0e0a64 tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c     Wed Jun 13 11:05:47 2007 +0100
+++ b/tools/xenstat/xentop/xentop.c     Wed Jun 13 11:13:11 2007 +0100
@@ -290,12 +290,24 @@ static void print(const char *fmt, ...)
        }
 }
 
+static void xentop_attron(int attr)
+{
+       if (!batch)
+               attron(attr);
+}
+
+static void xentop_attroff(int attr)
+{
+       if (!batch)
+               attroff(attr);
+}
+
 /* Print a string with the given attributes set. */
 static void attr_addstr(int attr, const char *str)
 {
-       attron(attr);
+       xentop_attron(attr);
        addstr((curses_str_t)str);
-       attroff(attr);
+       xentop_attroff(attr);
 }
 
 /* Handle setting the delay from the user-supplied value in prompt_val */
@@ -780,18 +792,18 @@ void do_header(void)
        field_id i;
 
        /* Turn on REVERSE highlight attribute for headings */
-       attron(A_REVERSE);
+       xentop_attron(A_REVERSE);
        for(i = 0; i < NUM_FIELDS; i++) {
-               if(i != 0)
+               if (i != 0)
                        print(" ");
                /* The BOLD attribute is turned on for the sort column */
-               if(i == sort_field)
-                       attron(A_BOLD);
+               if (i == sort_field)
+                       xentop_attron(A_BOLD);
                print("%*s", fields[i].default_width, fields[i].header);
-               if(i == sort_field)
-                       attroff(A_BOLD);
-       }
-       attroff(A_REVERSE);
+               if (i == sort_field)
+                       xentop_attroff(A_BOLD);
+       }
+       xentop_attroff(A_REVERSE);
        print("\n");
 }
 
@@ -838,14 +850,14 @@ void do_domain(xenstat_domain *domain)
 void do_domain(xenstat_domain *domain)
 {
        unsigned int i;
-       for(i = 0; i < NUM_FIELDS; i++) {
-               if(i != 0)
+       for (i = 0; i < NUM_FIELDS; i++) {
+               if (i != 0)
                        print(" ");
-               if(i == sort_field)
-                       attron(A_BOLD);
+               if (i == sort_field)
+                       xentop_attron(A_BOLD);
                fields[i].print(domain);
-               if(i == sort_field)
-                       attroff(A_BOLD);
+               if (i == sort_field)
+                       xentop_attroff(A_BOLD);
        }
        print("\n");
 }
@@ -956,7 +968,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);
@@ -976,7 +989,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();
@@ -989,8 +1002,8 @@ static void top(void)
                        do_vbd(domains[i]);
        }
 
-       if(!batch)
-       do_bottom_line();
+       if (!batch)
+               do_bottom_line();
 
        free(domains);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xentop: Fix -b option (batch mode)., Xen patchbot-unstable <=