Bug 246458 - [patch] systat - Introduced sysputpage() to display large page size with human readable format.
Summary: [patch] systat - Introduced sysputpage() to display large page size with huma...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2020-05-14 02:39 UTC by ota
Modified: 2021-01-03 16:32 UTC (History)
1 user (show)

See Also:


Attachments
display page size fields in SI unit (8.18 KB, patch)
2020-05-14 02:39 UTC, ota
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ota 2020-05-14 02:39:14 UTC
Created attachment 214477 [details]
display page size fields in SI unit

https://reviews.freebsd.org/D24834

Using UI units allows to fit larger numbers in columns.
Stop calling v_page_size - this is a value that doesn't change at runtime.
Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
Use bit-shift to convert page size to byte.

New screen:
    5 users    Load  0.23  0.27  0.17                  May 13 18:15
   Mem usage:   7%Phy  4%Kmem                           VN PAGER   SWAP PAGER
Mem:       REAL            VIRTUAL                      in   out     in   out
        Tot   Share      Tot    Share    Free  count
Act  56664K       0  335228K        0   2288M  pages
All  57400K  675840  336988K  1572864                     ioflt  Interrupts
Proc:                                                     cow      58 total
  r   p   d   s   w   Csw  Trp  Sys  Int  Sof  Flt        zfod      3 atkbd0 1
             58       164    1   50   23   16             ozfod    18 acpi0 9
                                                         %ozfod       psm0 12
 0.2%Sys   0.0%Intr  0.0%User  0.0%Nice 99.8%Idle         daefr     2 ata0 14
|    |    |    |    |    |    |    |    |    |    |       prcfr       ehci0 19
                                                          totfr       em1:irq0
                                         9 dtbuf          react       em0:irq0
Namei     Name-cache   Dir-cache    119343 maxvn          pdwak    24 cpu0:timer
   Calls    hits   %    hits   %      1621 numvn       10 pdpgs    11 cpu1:timer
      15      15 100                   248 frevn          intrn       ahci0:ch0
                                                     142M wire        ahci0:ch1
Disks  ada0  ada1  ada2  ada3   cd0 pass0 pass1    31916K act         ahci0:ch2
KB/t   0.00  0.00  0.00  0.00  0.00  0.00  0.00     3244K inact       ahci0:ch3
tps       0     0     0     0     0     1     0         0 laund
MB/s   0.00  0.00  0.00  0.00  0.00  0.00  0.00     2288M free


Old screen:
    6 users    Load  0.31  0.30  0.21                  May 13 18:20
   Mem usage:  10%Phy  5%Kmem
Mem: KB    REAL            VIRTUAL                      VN PAGER   SWAP PAGER
        Tot   Share      Tot    Share    Free           in   out     in   out
Act   59008           340200          2273772  count
All   59744     660   341960     1536          pages
Proc:                                                            Interrupts
  r   p   d   s   w   Csw  Trp  Sys  Int  Sof  Flt        ioflt    64 total
             59       195   36  138   28   20   35      6 cow       5 atkbd0 1
                                                       19 zfod     19 acpi0 9
 0.5%Sys   0.1%Intr  0.1%User  0.0%Nice 99.3%Idle       2 ozfod       psm0 12
|    |    |    |    |    |    |    |    |    |          8%ozfod     2 ata0 14
                                                          daefr       ehci0 19
                                         7 dtbuf       18 prcfr       em1:irq0
Namei     Name-cache   Dir-cache    119343 maxvn       33 totfr       em0:irq0
   Calls    hits   %    hits   %      2227 numvn          react    23 cpu0:timer
     233     214  92       2   1       538 frevn          pdwak    13 cpu1:timer
                                                       10 pdpgs     2 ahci0:ch0
Disks  ada0  ada1  ada2  ada3   cd0 pass0 pass1           intrn       ahci0:ch1
KB/t  10.22  0.00  0.00  0.00  0.00  0.00  0.00    173992 wire        ahci0:ch2
tps       2     0     0     0     0     1     0     34048 act         ahci0:ch3
MB/s   0.02  0.00  0.00  0.00  0.00  0.00  0.00     41712 inact
%busy     0     0     0     0     0     0     0           laund
                                                  2273772 free
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-05-15 17:37:55 UTC
A commit references this bug:

Author: mr
Date: Fri May 15 17:37:09 UTC 2020
New revision: 361084
URL: https://svnweb.freebsd.org/changeset/base/361084

Log:
  Introduce sysputpage() to display large page size with human readable format.
  Using UI units allows to fit larger numbers in columns.
  Stop calling v_page_size - this is a value that doesn't change at runtime.
  Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
  Use bit-shift to convert page size to byte.

  PR:             246458
  Submitted by:   ota@j.email.ne.jp
  MFC after: 2 weeks
  Differential Revision:  D24834

Changes:
  head/usr.bin/systat/extern.h
  head/usr.bin/systat/fetch.c
  head/usr.bin/systat/sysput.c
  head/usr.bin/systat/vmstat.c
Comment 2 Michael Reifenberger freebsd_committer freebsd_triage 2020-05-15 17:48:29 UTC
Hi,
looked good, and has been tested and committed.
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-06-07 16:42:25 UTC
A commit references this bug:

Author: mr
Date: Sun Jun  7 16:42:05 UTC 2020
New revision: 361896
URL: https://svnweb.freebsd.org/changeset/base/361896

Log:
  MFC r360919,r360929,r361084:

  Patch systat -zarc to display cumulative rate and round down large numbers by SI units

  Introduce sysputpage() to display large page size with human readable format.
    Using UI units allows to fit larger numbers in columns.
    Stop calling v_page_size - this is a value that doesn't change at runtime.
    Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
    Use bit-shift to convert page size to byte.

  PR:		237664, 246458
  Submitted by:	ota@j.email.ne.jp

Changes:
_U  stable/12/
  stable/12/usr.bin/systat/Makefile
  stable/12/usr.bin/systat/extern.h
  stable/12/usr.bin/systat/fetch.c
  stable/12/usr.bin/systat/main.c
  stable/12/usr.bin/systat/sysput.c
  stable/12/usr.bin/systat/vmstat.c
  stable/12/usr.bin/systat/zarc.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-01-03 16:31:29 UTC
A commit in branch stable/11 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=72b42d209ff5b37c615048fb251d7bf9eb276381

commit 72b42d209ff5b37c615048fb251d7bf9eb276381
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2018-11-15 17:25:32 +0000
Commit:     Michael Reifenberger <mr@FreeBSD.org>
CommitDate: 2021-01-03 16:29:50 +0000

    MFC r340361:

    Fix printing of 64-bit counters on 32-bit ppc platforms.

    Several statistic counters are uint64_t values and are printed by systat
    using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
    While there, print variables of size_t using %zd.

    Approved by:            re (gjb@)
    Differential Revision:  https://reviews.freebsd.org/D17838

    (cherry picked from commit 45e9405ea4b05926b22a743237cbfe918206db50)

    systat: use and correctly display 64bit counters.

    Following struct vmtotal changes, make systat use and correctly
    display 64-bit counters.  Switch to humanize_number(3) to overcome
    homegrown arithmetics limits in pretty printing large numbers.  Use
    1024 as a divisor for memory fields to make it consistent with other
    tools and users expectations.

    Submitted by:   Pawel Biernacki <pawel.biernacki@gmail.com>
    Sponsored by:   Mysterious Code Ltd.
    PR:     2137
    Differential revision:  https://reviews.freebsd.org/D13105

    (cherry picked from commit 90dd3e79cc4d721b17c473fdaf3ba3d6d912b138)

    Order declarations alphabetically.
    Match signess of the format and the value.

    Noted by:       bde
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 1b7a3d1f5ffe700203f12654cd01a08a84551b4a)

    MFC r340361, r345804: catch up on systat in head/

    [Neither of these originally mine, but the latter commit referenced
    fixes an -fno-common issue and the former is a bugfix]

    r340361:
    Fix printing of 64-bit counters on 32-bit ppc platforms.

    Several statistic counters are uint64_t values and are printed by systat
    using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
    While there, print variables of size_t using %zd.

    r345804:
    systat -zarc to display disk activities like -vm

    PR:             213310
    (cherry picked from commit a70af2507f720c2d7f56f51a18d358123b4770a5)

    MFC r360919,r360929,r361084:

    Patch systat -zarc to display cumulative rate and round down large numbers by SI units

    Introduce sysputpage() to display large page size with human readable format.
      Using UI units allows to fit larger numbers in columns.
      Stop calling v_page_size - this is a value that doesn't change at runtime.
      Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
      Use bit-shift to convert page size to byte.

    PR:             237664, 246458
    Submitted by:   ota@j.email.ne.jp

    (cherry picked from commit 65d1fd13ac2182f7ca0c223bb723fba6d780740f)

    MFC r363095:
    Handle device removal and removal+add cases to fix infinity rate.

    PR:             219829
    Submitted by:   ota@j.email.ne.jp
    Reported by:    rezo@live.cn
    Differential Revision:  https://reviews.freebsd.org/D25226

    (cherry picked from commit 7a446028cedb13a0d2004cf6f584291a976392da)

    PR:             219829, 237664, 246458, 213310, 2137

 usr.bin/systat/Makefile       |   4 +-
 usr.bin/systat/devs.c         | 126 ++++++++++++++++++++++--
 usr.bin/systat/devs.h         |  16 ++-
 usr.bin/systat/extern.h       |   7 +-
 usr.bin/systat/fetch.c        |   9 +-
 usr.bin/systat/icmp6.c        |   9 +-
 usr.bin/systat/ifcmds.c       |   2 +
 usr.bin/systat/ifstat.c       | 118 +++++++++++++---------
 usr.bin/systat/iostat.c       |  46 ++++-----
 usr.bin/systat/ip.c           |   7 +-
 usr.bin/systat/ip6.c          |   7 +-
 usr.bin/systat/main.c         |  13 +--
 usr.bin/systat/swap.c         |  17 +++-
 usr.bin/systat/sysput.c (new) | 118 ++++++++++++++++++++++
 usr.bin/systat/systat.1       |   1 +
 usr.bin/systat/systat.h       |   4 +
 usr.bin/systat/tcp.c          |   3 +-
 usr.bin/systat/vmstat.c       | 221 +++++++++++++++---------------------------
 usr.bin/systat/zarc.c         | 124 +++++++++++++++---------
 19 files changed, 548 insertions(+), 304 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-01-03 16:32:06 UTC
A commit in branch stable/11 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=72b42d209ff5b37c615048fb251d7bf9eb276381

commit 72b42d209ff5b37c615048fb251d7bf9eb276381
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2018-11-15 17:25:32 +0000
Commit:     Michael Reifenberger <mr@FreeBSD.org>
CommitDate: 2021-01-03 16:29:50 +0000

    MFC r340361:

    Fix printing of 64-bit counters on 32-bit ppc platforms.

    Several statistic counters are uint64_t values and are printed by systat
    using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
    While there, print variables of size_t using %zd.

    Approved by:            re (gjb@)
    Differential Revision:  https://reviews.freebsd.org/D17838

    (cherry picked from commit 45e9405ea4b05926b22a743237cbfe918206db50)

    systat: use and correctly display 64bit counters.

    Following struct vmtotal changes, make systat use and correctly
    display 64-bit counters.  Switch to humanize_number(3) to overcome
    homegrown arithmetics limits in pretty printing large numbers.  Use
    1024 as a divisor for memory fields to make it consistent with other
    tools and users expectations.

    Submitted by:   Pawel Biernacki <pawel.biernacki@gmail.com>
    Sponsored by:   Mysterious Code Ltd.
    PR:     2137
    Differential revision:  https://reviews.freebsd.org/D13105

    (cherry picked from commit 90dd3e79cc4d721b17c473fdaf3ba3d6d912b138)

    Order declarations alphabetically.
    Match signess of the format and the value.

    Noted by:       bde
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 1b7a3d1f5ffe700203f12654cd01a08a84551b4a)

    MFC r340361, r345804: catch up on systat in head/

    [Neither of these originally mine, but the latter commit referenced
    fixes an -fno-common issue and the former is a bugfix]

    r340361:
    Fix printing of 64-bit counters on 32-bit ppc platforms.

    Several statistic counters are uint64_t values and are printed by systat
    using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
    While there, print variables of size_t using %zd.

    r345804:
    systat -zarc to display disk activities like -vm

    PR:             213310
    (cherry picked from commit a70af2507f720c2d7f56f51a18d358123b4770a5)

    MFC r360919,r360929,r361084:

    Patch systat -zarc to display cumulative rate and round down large numbers by SI units

    Introduce sysputpage() to display large page size with human readable format.
      Using UI units allows to fit larger numbers in columns.
      Stop calling v_page_size - this is a value that doesn't change at runtime.
      Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
      Use bit-shift to convert page size to byte.

    PR:             237664, 246458
    Submitted by:   ota@j.email.ne.jp

    (cherry picked from commit 65d1fd13ac2182f7ca0c223bb723fba6d780740f)

    MFC r363095:
    Handle device removal and removal+add cases to fix infinity rate.

    PR:             219829
    Submitted by:   ota@j.email.ne.jp
    Reported by:    rezo@live.cn
    Differential Revision:  https://reviews.freebsd.org/D25226

    (cherry picked from commit 7a446028cedb13a0d2004cf6f584291a976392da)

    PR:             219829, 237664, 246458, 213310, 2137

 usr.bin/systat/Makefile       |   4 +-
 usr.bin/systat/devs.c         | 126 ++++++++++++++++++++++--
 usr.bin/systat/devs.h         |  16 ++-
 usr.bin/systat/extern.h       |   7 +-
 usr.bin/systat/fetch.c        |   9 +-
 usr.bin/systat/icmp6.c        |   9 +-
 usr.bin/systat/ifcmds.c       |   2 +
 usr.bin/systat/ifstat.c       | 118 +++++++++++++---------
 usr.bin/systat/iostat.c       |  46 ++++-----
 usr.bin/systat/ip.c           |   7 +-
 usr.bin/systat/ip6.c          |   7 +-
 usr.bin/systat/main.c         |  13 +--
 usr.bin/systat/swap.c         |  17 +++-
 usr.bin/systat/sysput.c (new) | 118 ++++++++++++++++++++++
 usr.bin/systat/systat.1       |   1 +
 usr.bin/systat/systat.h       |   4 +
 usr.bin/systat/tcp.c          |   3 +-
 usr.bin/systat/vmstat.c       | 221 +++++++++++++++---------------------------
 usr.bin/systat/zarc.c         | 124 +++++++++++++++---------
 19 files changed, 548 insertions(+), 304 deletions(-)