diff mbox series

tools/xentop: fix sorting bug for some columns

Message ID 1bb93dbf9d09091fa36a3966ad8ffbccdb742166.1707041980.git.slack@rabbit.lu (mailing list archive)
State New, archived
Headers show
Series tools/xentop: fix sorting bug for some columns | expand

Commit Message

zithro Feb. 4, 2024, 10:19 a.m. UTC
From: Cyril Rébert <slack@rabbit.lu>

Sort doesn't work on columns VBD_OO, VBD_RD, VBD_WR and VBD_RSECT.
Fix by adjusting variables names in compare functions.
Bug fix only. No functional change.

Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>
---
 tools/xentop/xentop.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Anthony PERARD Feb. 5, 2024, 5:37 p.m. UTC | #1
On Sun, Feb 04, 2024 at 11:19:40AM +0100, zithro / Cyril Rébert wrote:
> From: Cyril Rébert <slack@rabbit.lu>
> 
> Sort doesn't work on columns VBD_OO, VBD_RD, VBD_WR and VBD_RSECT.
> Fix by adjusting variables names in compare functions.
> Bug fix only. No functional change.
> 
> Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>

Looks like this wants:
Fixes: 91c3e3dc91d6 ("tools/xentop: Display '-' when stats are not available.")

Otherwise, patch looks fine:
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
Andrew Cooper Feb. 5, 2024, 6:02 p.m. UTC | #2
On 05/02/2024 5:37 pm, Anthony PERARD wrote:
> On Sun, Feb 04, 2024 at 11:19:40AM +0100, zithro / Cyril Rébert wrote:
>> From: Cyril Rébert <slack@rabbit.lu>
>>
>> Sort doesn't work on columns VBD_OO, VBD_RD, VBD_WR and VBD_RSECT.
>> Fix by adjusting variables names in compare functions.
>> Bug fix only. No functional change.
>>
>> Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>
> Looks like this wants:
> Fixes: 91c3e3dc91d6 ("tools/xentop: Display '-' when stats are not available.")
>
> Otherwise, patch looks fine:
> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Committed, thanks.

~Andrew
diff mbox series

Patch

diff --git a/tools/xentop/xentop.c b/tools/xentop/xentop.c
index 950e8935c4..545bd5e96d 100644
--- a/tools/xentop/xentop.c
+++ b/tools/xentop/xentop.c
@@ -684,7 +684,7 @@  static int compare_vbd_oo(xenstat_domain *domain1, xenstat_domain *domain2)
 	unsigned long long dom1_vbd_oo = 0, dom2_vbd_oo = 0;
 
 	tot_vbd_reqs(domain1, FIELD_VBD_OO, &dom1_vbd_oo);
-	tot_vbd_reqs(domain1, FIELD_VBD_OO, &dom2_vbd_oo);
+	tot_vbd_reqs(domain2, FIELD_VBD_OO, &dom2_vbd_oo);
 
 	return -compare(dom1_vbd_oo, dom2_vbd_oo);
 }
@@ -711,9 +711,9 @@  static int compare_vbd_rd(xenstat_domain *domain1, xenstat_domain *domain2)
 	unsigned long long dom1_vbd_rd = 0, dom2_vbd_rd = 0;
 
 	tot_vbd_reqs(domain1, FIELD_VBD_RD, &dom1_vbd_rd);
-	tot_vbd_reqs(domain1, FIELD_VBD_RD, &dom2_vbd_rd);
+	tot_vbd_reqs(domain2, FIELD_VBD_RD, &dom2_vbd_rd);
 
-	return -compare(dom1_vbd_rd, dom1_vbd_rd);
+	return -compare(dom1_vbd_rd, dom2_vbd_rd);
 }
 
 /* Prints number of total VBD READ requests statistic */
@@ -738,7 +738,7 @@  static int compare_vbd_wr(xenstat_domain *domain1, xenstat_domain *domain2)
 	unsigned long long dom1_vbd_wr = 0, dom2_vbd_wr = 0;
 
 	tot_vbd_reqs(domain1, FIELD_VBD_WR, &dom1_vbd_wr);
-	tot_vbd_reqs(domain1, FIELD_VBD_WR, &dom2_vbd_wr);
+	tot_vbd_reqs(domain2, FIELD_VBD_WR, &dom2_vbd_wr);
 
 	return -compare(dom1_vbd_wr, dom2_vbd_wr);
 }
@@ -765,7 +765,7 @@  static int compare_vbd_rsect(xenstat_domain *domain1, xenstat_domain *domain2)
 	unsigned long long dom1_vbd_rsect = 0, dom2_vbd_rsect = 0;
 
 	tot_vbd_reqs(domain1, FIELD_VBD_RSECT, &dom1_vbd_rsect);
-	tot_vbd_reqs(domain1, FIELD_VBD_RSECT, &dom2_vbd_rsect);
+	tot_vbd_reqs(domain2, FIELD_VBD_RSECT, &dom2_vbd_rsect);
 
 	return -compare(dom1_vbd_rsect, dom2_vbd_rsect);
 }