diff mbox series

[v2] tools/xentop: add option to display dom0 first

Message ID efdca3e0c02576c624403d273c7168c9303fcc52.1707232545.git.slack@rabbit.lu (mailing list archive)
State Superseded
Headers show
Series [v2] tools/xentop: add option to display dom0 first | expand

Commit Message

zithro Feb. 6, 2024, 3:15 p.m. UTC
Add a command line option to xentop to be able to display dom0 first, on top of the list.
This is unconditional, so sorting domains with the S option will also ignore dom0.

Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>

---
Changes in v2:
- bug fix
- add documentation
---
 docs/man/xentop.1.pod | 6 +++++-
 tools/xentop/xentop.c | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Anthony PERARD Feb. 7, 2024, 4 p.m. UTC | #1
On Tue, Feb 06, 2024 at 04:15:45PM +0100, zithro / Cyril Rébert wrote:
> Add a command line option to xentop to be able to display dom0 first, on top of the list.
> This is unconditional, so sorting domains with the S option will also ignore dom0.
> 
> Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>
> 
> ---
> Changes in v2:
> - bug fix
> - add documentation

Looks like this v2 contains only changes from v1. Could you instead
squash both version and send it as v3? After that, it looks like the
patch would be ready to be committed (changes looks fine if I look at
both version).

Thanks,
diff mbox series

Patch

diff --git a/docs/man/xentop.1.pod b/docs/man/xentop.1.pod
index 126f43d2f3..593a484ce7 100644
--- a/docs/man/xentop.1.pod
+++ b/docs/man/xentop.1.pod
@@ -5,7 +5,7 @@  xentop - displays real-time information about a Xen system and domains
 =head1 SYNOPSIS
 
 B<xentop> [B<-h>] [B<-V>] [B<-d>SECONDS] [B<-n>] [B<-r>] [B<-v>] [B<-f>]
-[B<-b>] [B<-i>ITERATIONS]
+[B<-b>] [B<-i>ITERATIONS] [B<-z>]
 
 =head1 DESCRIPTION
 
@@ -57,6 +57,10 @@  output data in batch mode (to stdout)
 
 maximum number of iterations xentop should produce before ending
 
+=item B<-z>, B<--dom0-first>
+
+display dom0 first, ignoring interactive sorting
+
 =back
 
 =head1 INTERACTIVE COMMANDS
diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index 9068c53fd2..5462e6a426 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -211,7 +211,7 @@  int show_networks = 0;
 int show_vbds = 0;
 int repeat_header = 0;
 int show_full_name = 0;
-int dom0_first = -1;
+int dom0_first = 0;
 #define PROMPT_VAL_LEN 80
 const char *prompt = NULL;
 char prompt_val[PROMPT_VAL_LEN];
@@ -1164,8 +1164,9 @@  void do_vbd(xenstat_domain *domain)
 static void top(void)
 {
 	xenstat_domain **domains;
-	unsigned int i, num_domains, sort_start, sort_count = 0;
+	unsigned int i, num_domains = 0;
 	int dom0_index = -1;
+	int sort_start = 0, sort_count = 0;
 
 	/* Now get the node information */
 	if (prev_node != NULL)