diff mbox series

[2/3] tools/xentop: Remove dead code

Message ID a5d34e806a0798e411b405625d1ef74db998fc85.1582143896.git.linux@eikelenboom.it (mailing list archive)
State New, archived
Headers show
Series tools/xentop: Fix calculation of used memory and some cleanups | expand

Commit Message

Sander Eikelenboom Feb. 19, 2020, 8:31 p.m. UTC
Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
---
 tools/xenstat/xentop/xentop.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Wei Liu Feb. 20, 2020, 12:51 a.m. UTC | #1
On Wed, Feb 19, 2020 at 09:31:31PM +0100, Sander Eikelenboom wrote:
> Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
> ---

I will add the following commit message:

The variable freealbe_mb was never really used. Delete it and the code
associated with it.

Acked-by: Wei Liu <wl@xen.org>

>  tools/xenstat/xentop/xentop.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
> index 13b612f26d..bbb5d47b76 100644
> --- a/tools/xenstat/xentop/xentop.c
> +++ b/tools/xenstat/xentop/xentop.c
> @@ -943,7 +943,6 @@ void do_summary(void)
>  	         crash = 0, dying = 0, shutdown = 0;
>  	unsigned i, num_domains = 0;
>  	unsigned long long used = 0;
> -	long freeable_mb = 0;
>  	xenstat_domain *domain;
>  	time_t curt;
>  
> @@ -970,17 +969,12 @@ void do_summary(void)
>  	      num_domains, run, block, pause, crash, dying, shutdown);
>  
>  	used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node);
> -	freeable_mb = 0;
>  
>  	/* Dump node memory and cpu information */
> -	if ( freeable_mb <= 0 )
> -	     print("Mem: %lluk total, %lluk used, %lluk free    ",
> +	print("Mem: %lluk total, %lluk used, %lluk free    ",
>  	      xenstat_node_tot_mem(cur_node)/1024, used/1024,
>  	      xenstat_node_free_mem(cur_node)/1024);
> -	else
> -	     print("Mem: %lluk total, %lluk used, %lluk free, %ldk freeable, ",
> -	      xenstat_node_tot_mem(cur_node)/1024, used/1024,
> -	      xenstat_node_free_mem(cur_node)/1024, freeable_mb*1024);
> +
>  	print("CPUs: %u @ %lluMHz\n",
>  	      xenstat_node_num_cpus(cur_node),
>  	      xenstat_node_cpu_hz(cur_node)/1000000);
> -- 
> 2.20.1
>
Wei Liu Feb. 20, 2020, 12:56 a.m. UTC | #2
On Thu, Feb 20, 2020 at 12:51:23AM +0000, Wei Liu wrote:
> On Wed, Feb 19, 2020 at 09:31:31PM +0100, Sander Eikelenboom wrote:
> > Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
> > ---
> 
> I will add the following commit message:
> 
> The variable freealbe_mb was never really used. Delete it and the code
> associated with it.

Actually, use the following:

The freeable_mb variable was made to always be zero when purging tmem
from tools. We can in fact just delete it and the code associated with
it.

Fixes: c588c002cc1 ("tools: remove tmem code and commands")
diff mbox series

Patch

diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c
index 13b612f26d..bbb5d47b76 100644
--- a/tools/xenstat/xentop/xentop.c
+++ b/tools/xenstat/xentop/xentop.c
@@ -943,7 +943,6 @@  void do_summary(void)
 	         crash = 0, dying = 0, shutdown = 0;
 	unsigned i, num_domains = 0;
 	unsigned long long used = 0;
-	long freeable_mb = 0;
 	xenstat_domain *domain;
 	time_t curt;
 
@@ -970,17 +969,12 @@  void do_summary(void)
 	      num_domains, run, block, pause, crash, dying, shutdown);
 
 	used = xenstat_node_tot_mem(cur_node)-xenstat_node_free_mem(cur_node);
-	freeable_mb = 0;
 
 	/* Dump node memory and cpu information */
-	if ( freeable_mb <= 0 )
-	     print("Mem: %lluk total, %lluk used, %lluk free    ",
+	print("Mem: %lluk total, %lluk used, %lluk free    ",
 	      xenstat_node_tot_mem(cur_node)/1024, used/1024,
 	      xenstat_node_free_mem(cur_node)/1024);
-	else
-	     print("Mem: %lluk total, %lluk used, %lluk free, %ldk freeable, ",
-	      xenstat_node_tot_mem(cur_node)/1024, used/1024,
-	      xenstat_node_free_mem(cur_node)/1024, freeable_mb*1024);
+
 	print("CPUs: %u @ %lluMHz\n",
 	      xenstat_node_num_cpus(cur_node),
 	      xenstat_node_cpu_hz(cur_node)/1000000);