Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jun 2018 03:17:11 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335576 - head/usr.bin/top
Message-ID:  <201806230317.w5N3HBQX089405@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Sat Jun 23 03:17:11 2018
New Revision: 335576
URL: https://svnweb.freebsd.org/changeset/base/335576

Log:
  top(1): show CPU state breakdown on first run
  
  There is no documented reason for this not to be shown on the first run.
  I can't find any good reason, and it breaks batch mode.
  
  PR:		218889
  Submitted by:	"Jeremy C. Reed" <reed@reedmedia.net>

Modified:
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c	Sat Jun 23 02:42:08 2018	(r335575)
+++ head/usr.bin/top/top.c	Sat Jun 23 03:17:11 2018	(r335576)
@@ -243,7 +243,6 @@ main(int argc, char *argv[])
     int  preset_argc = 0;
     const char **av = NULL;
     int  ac = -1;
-    bool dostates = false;
     bool do_unames = true;
     char interactive = 2;
     char warnings = 0;
@@ -641,25 +640,7 @@ restart:
 	/* display process state breakdown */
 	(*d_procstates)(system_info.p_total,
 			system_info.procstates);
-
-	/* display the cpu state percentage breakdown */
-	if (dostates)	/* but not the first time */
-	{
-	    (*d_cpustates)(system_info.cpustates);
-	}
-	else
-	{
-	    /* we'll do it next time */
-	    if (smart_terminal)
-	    {
-		z_cpustates();
-	    }
-	    else
-	    {
-		putchar('\n');
-	    }
-	    dostates = true;
-	}
+	(*d_cpustates)(system_info.cpustates);
 
 	/* display memory stats */
 	(*d_memory)(system_info.memory);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806230317.w5N3HBQX089405>