Bug 237664 - [patch] systat -zarc to display cumulative rate and round down large numbers by SI units
Summary: [patch] systat -zarc to display cumulative rate and round down large numbers ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Reifenberger
URL:
Keywords: patch
Depends on: 213310
Blocks:
  Show dependency treegraph
 
Reported: 2019-04-30 03:37 UTC by ota
Modified: 2021-01-03 16:31 UTC (History)
1 user (show)

See Also:


Attachments
systat -zarc improved (8.02 KB, patch)
2019-04-30 03:37 UTC, ota
no flags Details | Diff
systat -zarc improved 2 (8.59 KB, patch)
2019-05-01 07:02 UTC, ota
no flags Details | Diff
systat -zarc improved 3 (8.59 KB, patch)
2019-05-01 07:07 UTC, ota
no flags Details | Diff
systat -zarc improved 4 (9.56 KB, patch)
2019-05-01 22:22 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 2019-04-30 03:37:24 UTC
Created attachment 204106 [details]
systat -zarc improved

Update to display cumulative rate and also make numebrs easier to read.

== OLD screen == 
                       Total     MFU     MRU    Anon     Hdr   L2Hdr   Other
     ZFS ARC            813M    555M    111M     81K   9821K      0K    137M

                                rate    hits  misses   total hits total misses
     arcstats                  : 89%    6714     761     36912905      3781817
     arcstats.demand_data      :  0%       0       0      6825292      1204922
     arcstats.demand_metadata  : 89%    6715     761     29924478      2508183
     arcstats.prefetch_data    :  0%       0       0            0            0
     arcstats.prefetch_metadata:  0%       0       0       163138        68712
     zfetchstats               :  0%       0       0            0            0
     arcstats.l2               :  0%       0       0            0            0
     vdev_cache_stats          :  0%       0       0            0            0






Disks  ada0   da0   cd0 pass0 pass1 pass2
KB/t   0.50  0.00  0.00  0.00  0.00  0.00
tps       0     0     0     0     0     0
MB/s   0.00  0.00  0.00  0.00  0.00  0.00
%busy     0     0     0     0     0     0

== NEW screen == 

                       Total     MFU     MRU    Anon     Hdr   L2Hdr   Other
     ZFS ARC            814M    556M    111M   32768   9823K       0    137M

                                Rate   Hits Misses | Total Rate   Hits Misses
     arcstats                  : 88%  41279   5260 |        90% 37209k  3809k
     arcstats.demand_data      :100%   4200      0 |        85%  6833k  1205k
     arcstats.demand_metadata  : 87%  36709   5260 |        92% 30213k  2535k
     arcstats.prefetch_data    :  0%      0      0 |         0%      0      0
     arcstats.prefetch_metadata:100%    370      0 |        70%   164k  68919
     zfetchstats               :  0%      0      0 |         0%      0      0
     arcstats.l2               :  0%      0      0 |         0%      0      0
     vdev_cache_stats          :  0%      0      0 |         0%      0      0






Disks  ada0   da0   cd0 pass0 pass1 pass2
KB/t   0.00  0.00  0.00  0.00  0.00  0.00
tps       0     0     0     0     0     0
MB/s   0.00  0.00  0.00  0.00  0.00  0.00
%busy     0     0     0     0     0     0
Comment 1 ota 2019-05-01 07:02:38 UTC
Created attachment 204133 [details]
systat -zarc improved 2

Fixed style.
Comment 2 ota 2019-05-01 07:07:37 UTC
Created attachment 204134 [details]
systat -zarc improved 3

Fixed another style.
Comment 3 ota 2019-05-01 22:22:18 UTC
Created attachment 204155 [details]
systat -zarc improved 4

Avoid wnd as function argument name as it is also a global variable name.
Few more style fixes.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-05-11 20:35:33 UTC
A commit references this bug:

Author: mr
Date: Mon May 11 20:34:53 UTC 2020
New revision: 360919
URL: https://svnweb.freebsd.org/changeset/base/360919

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

  PR:		237664
  Submitted by:	ota@j.email.ne.jp
  MFC after:	2 weeks

Changes:
  head/usr.bin/systat/Makefile
  head/usr.bin/systat/extern.h
  head/usr.bin/systat/main.c
  head/usr.bin/systat/zarc.c
Comment 5 Michael Reifenberger freebsd_committer freebsd_triage 2020-05-11 20:37:08 UTC
Hi,
committed to -current.

Thanks for providing!

greetings
---
mike
Comment 6 commit-hook freebsd_committer freebsd_triage 2020-05-11 21:22:40 UTC
A commit references this bug:

Author: mr
Date: Mon May 11 21:22:16 UTC 2020
New revision: 360929
URL: https://svnweb.freebsd.org/changeset/base/360929

Log:
  Add missing sysput.c

  PR:		237664
  Submitted by:	ota@j.email.ne.jp
  Reported by:	imb, cy

Changes:
  head/usr.bin/systat/sysput.c
Comment 7 ota 2020-05-13 01:43:04 UTC
(In reply to Michael Reifenberger from comment #5)

Thank you for taking patches.

I have few more small fixes and improvements locally.
I will be nice if you can assist in the future, too.
Comment 8 ota 2020-05-14 02:40:00 UTC
(In reply to ota from comment #7)

Next patch is not on zarc and decided to create a new one.
It is https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246458
Comment 9 Michael Reifenberger freebsd_committer freebsd_triage 2020-05-15 17:25:51 UTC
(In reply to ota from comment #7)
Hi,
yes of corse.
Please feel free to submit what you have.

Greetings
---
Mike
Comment 10 ota 2020-06-07 02:27:43 UTC
(In reply to Michael Reifenberger from comment #9)

Hi Michael.

I'm wondering if you could merge the series of systat changes to 12-STABLE.
Comment 11 commit-hook freebsd_committer freebsd_triage 2020-06-07 16:42:29 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 12 Michael Reifenberger freebsd_committer freebsd_triage 2020-06-07 16:44:48 UTC
Hi,
it's MFC'd now.

I havn't checked if the change is apropriate for FreeBSD-11 too.

Thanks for your work!
Comment 13 Mark Linimon freebsd_committer freebsd_triage 2020-07-11 03:09:55 UTC
^Triage: Assign to committer resolving
Comment 14 commit-hook freebsd_committer freebsd_triage 2021-01-03 16:31:21 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 15 commit-hook freebsd_committer freebsd_triage 2021-01-03 16:31:27 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(-)