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

zithro / Cyril Rébert posted 1 patch 2 weeks, 4 days ago
Failed in applying to current master (apply log)
There is a newer version of this series
docs/man/xentop.1.pod | 6 +++++-
tools/xentop/xentop.c | 5 +++--
2 files changed, 8 insertions(+), 3 deletions(-)
[PATCH v2] tools/xentop: add option to display dom0 first
Posted by zithro / Cyril Rébert 2 weeks, 4 days ago
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(-)

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)
-- 
2.39.2


Re: [PATCH v2] tools/xentop: add option to display dom0 first
Posted by Anthony PERARD 2 weeks, 3 days ago
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,

-- 
Anthony PERARD