Bug 218889 - top show CPU states header in batch mode
Summary: top show CPU states header in batch mode
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: FreeBSD bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-04-26 13:35 UTC by reed
Modified: 2017-04-26 16:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description reed 2017-04-26 13:35:36 UTC
(The component field here in bugzilla doesn't have "contrib" so I chose "bin".)

I don't know history of why the dostates toggle is there to not show the CPU: states "the first time".  But this makes it so the batch view (like piped top to a file) excludes the CPU states and just has a blank line there.

Here is a simple fix (but maybe fix comment). Or maybe just get rid of "dostates".

Index: contrib/top/top.c
===================================================================
--- contrib/top/top.c   (revision 317435)
+++ contrib/top/top.c   (working copy)
@@ -637,7 +637,7 @@
                        system_info.procstates);
 
        /* display the cpu state percentage breakdown */
-       if (dostates)   /* but not the first time */
+       if ((!interactive) || (dostates))       /* but not the first time */
        {
            (*d_cpustates)(system_info.cpustates);
        }

(I originally saw this problem with pfSense's System Activity page while authoring a book about it.)