From 8d2136f8fde6b435eb2dddcf876020cdbdbc806b Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Thu, 7 May 2020 17:49:00 -0400 Subject: [PATCH 1/4] Fix inconsistent capitalization in `arcstat -v` Signed-off-by: AJ Jordan --- cmd/arcstat/arcstat | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/arcstat/arcstat b/cmd/arcstat/arcstat index 66d7e3a8da7a..ecdbfafe3a3f 100755 --- a/cmd/arcstat/arcstat +++ b/cmd/arcstat/arcstat @@ -60,7 +60,7 @@ cols = { "hits": [4, 1000, "ARC reads per second"], "miss": [4, 1000, "ARC misses per second"], "read": [4, 1000, "Total ARC accesses per second"], - "hit%": [4, 100, "ARC Hit percentage"], + "hit%": [4, 100, "ARC hit percentage"], "miss%": [5, 100, "ARC miss percentage"], "dhit": [4, 1000, "Demand hits per second"], "dmis": [4, 1000, "Demand misses per second"], @@ -75,12 +75,12 @@ cols = { "mread": [5, 1000, "Metadata accesses per second"], "mh%": [3, 100, "Metadata hit percentage"], "mm%": [3, 100, "Metadata miss percentage"], - "arcsz": [5, 1024, "ARC Size"], - "c": [4, 1024, "ARC Target Size"], - "mfu": [4, 1000, "MFU List hits per second"], - "mru": [4, 1000, "MRU List hits per second"], - "mfug": [4, 1000, "MFU Ghost List hits per second"], - "mrug": [4, 1000, "MRU Ghost List hits per second"], + "arcsz": [5, 1024, "ARC size"], + "c": [4, 1024, "ARC target size"], + "mfu": [4, 1000, "MFU list hits per second"], + "mru": [4, 1000, "MRU list hits per second"], + "mfug": [4, 1000, "MFU ghost list hits per second"], + "mrug": [4, 1000, "MRU ghost list hits per second"], "eskip": [5, 1000, "evict_skip per second"], "mtxmis": [6, 1000, "mutex_miss per second"], "dread": [5, 1000, "Demand accesses per second"], @@ -92,10 +92,10 @@ cols = { "l2miss%": [7, 100, "L2ARC access miss percentage"], "l2asize": [7, 1024, "Actual (compressed) size of the L2ARC"], "l2size": [6, 1024, "Size of the L2ARC"], - "l2bytes": [7, 1024, "bytes read per second from the L2ARC"], - "grow": [4, 1000, "ARC Grow disabled"], - "need": [4, 1024, "ARC Reclaim need"], - "free": [4, 1024, "ARC Free memory"], + "l2bytes": [7, 1024, "Bytes read per second from the L2ARC"], + "grow": [4, 1000, "ARC grow disabled"], + "need": [4, 1024, "ARC reclaim need"], + "free": [4, 1024, "ARC free memory"], } v = {} From d4a24e8a942847340e5cdcd9f36230d87570f858 Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Sun, 3 May 2020 22:23:46 -0400 Subject: [PATCH 2/4] Import the arcstat(1m) manpage from illumos And move it from section 1m to section 1 for consistency. Imported from illumos commit f34d737f. Signed-off-by: AJ Jordan Ref #10287 --- man/man1/arcstat.1 | 455 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 455 insertions(+) create mode 100644 man/man1/arcstat.1 diff --git a/man/man1/arcstat.1 b/man/man1/arcstat.1 new file mode 100644 index 000000000000..f65095fe57dc --- /dev/null +++ b/man/man1/arcstat.1 @@ -0,0 +1,455 @@ +.\" +.\" This file and its contents are supplied under the terms of the +.\" Common Development and Distribution License ("CDDL"), version 1.0. +.\" You may only use this file in accordance with the terms of version +.\" 1.0 of the CDDL. +.\" +.\" A full copy of the text of the CDDL should have accompanied this +.\" source. A copy of the CDDL is also available via the Internet at +.\" http://www.illumos.org/license/CDDL. +.\" +.\" +.\" Copyright 2014 Adam Stevko. All rights reserved. +.\" Copyright (c) 2015 by Delphix. All rights reserved. +.\" +.TH ARCSTAT 1M "Feb 4, 2014" +.SH NAME +arcstat \- report ZFS ARC and L2ARC statistics +.SH SYNOPSIS +.LP +.nf +\fBarcstat\fR [\fB-hvxr\fR] [\fB-f field[,field]...\fR] [\fB-o file\fR] [\fB-s string\fR] + [\fBinterval\fR [\fBcount\fR]] +.fi + +.SH DESCRIPTION +.LP +The \fBarcstat\fR utility print various ZFS ARC and L2ARC statistics in +vmstat-like fashion. +.sp + +.sp +.LP +The \fBarcstat\fR command reports the following information: +.sp +.ne 2 + +.\" +.sp +.ne 1 +.na +\fBc \fR +.ad +.RS 14n +ARC Target Size +.RE + +.sp +.ne 2 +.na +\fBdh% \fR +.ad +.RS 14n +Demand Data hit percentage +.RE + +.sp +.ne 2 +.na +\fBdm% \fR +.ad +.RS 14n +Demand Data miss percentage +.RE + +.sp +.ne 2 +.na +\fBmfu \fR +.ad +.RS 14n +MFU List hits per second +.RE + +.sp +.ne 2 +.na +\fBmh% \fR +.ad +.RS 14n +Metadata hit percentage +.RE + +.sp +.ne 2 +.na +\fBmm% \fR +.ad +.RS 14n +Metadata miss percentage +.RE + +.sp +.ne 2 +.na +\fBmru \fR +.ad +.RS 14n +MRU List hits per second +.RE + +.sp +.ne 2 +.na +\fBph% \fR +.ad +.RS 14n +Prefetch hits percentage +.RE + +.sp +.ne 2 +.na +\fBpm% \fR +.ad +.RS 14n +Prefetch miss percentage +.RE + +.sp +.ne 2 +.na +\fBdhit \fR +.ad +.RS 14n +Demand Data hits per second +.RE + +.sp +.ne 2 +.na +\fBdmis \fR +.ad +.RS 14n +Demand Data misses per second +.RE + +.sp +.ne 2 +.na +\fBhit% \fR +.ad +.RS 14n +ARC Hit percentage +.RE + +.sp +.ne 2 +.na +\fBhits \fR +.ad +.RS 14n +ARC reads per second +.RE + +.sp +.ne 2 +.na +\fBmfug \fR +.ad +.RS 14n +MFU Ghost List hits per second +.RE + +.sp +.ne 2 +.na +\fBmhit \fR +.ad +.RS 14n +Metadata hits per second +.RE + +.sp +.ne 2 +.na +\fBmiss \fR +.ad +.RS 14n +ARC misses per second +.RE + +.sp +.ne 2 +.na +\fBmmis \fR +.ad +.RS 14n +Metadata misses per second +.RE + +.sp +.ne 2 +.na +\fBmrug \fR +.ad +.RS 14n +MRU Ghost List hits per second +.RE + +.sp +.ne 2 +.na +\fBphit \fR +.ad +.RS 14n +Prefetch hits per second +.RE + +.sp +.ne 2 +.na +\fBpmis \fR +.ad +.RS 14n +Prefetch misses per second +.RE + +.sp +.ne 2 +.na +\fBread \fR +.ad +.RS 14n +Total ARC accesses per second +.RE + +.sp +.ne 2 +.na +\fBtime \fR +.ad +.RS 14n +Time +.RE + +.sp +.ne 2 +.na +\fBarcsz \fR +.ad +.RS 14n +ARC Size +.RE + +.sp +.ne 2 +.na +\fBdread \fR +.ad +.RS 14n +Demand data accesses per second +.RE + +.sp +.ne 2 +.na +\fBeskip \fR +.ad +.RS 14n +evict_skip per second +.RE + +.sp +.ne 2 +.na +\fBmiss% \fR +.ad +.RS 14n +ARC miss percentage +.RE + +.sp +.ne 2 +.na +\fBmread \fR +.ad +.RS 14n +Metadata accesses per second +.RE + +.sp +.ne 2 +.na +\fBpread \fR +.ad +.RS 14n +Prefetch accesses per second +.RE + +.sp +.ne 2 +.na +\fBl2hit% \fR +.ad +.RS 14n +L2ARC access hit percentage +.RE + +.sp +.ne 2 +.na +\fBl2hits \fR +.ad +.RS 14n +L2ARC hits per second +.RE + +.sp +.ne 2 +.na +\fBl2miss \fR +.ad +.RS 14n +L2ARC misses per second +.RE + +.sp +.ne 2 +.na +\fBl2read \fR +.ad +.RS 14n +Total L2ARC accesses per second +.RE + +.sp +.ne 2 +.na +\fBl2size \fR +.ad +.RS 14n +Size of the L2ARC +.RE + +.sp +.ne 2 +.na +\fBmtxmis \fR +.ad +.RS 14n +mutex_miss per second +.RE + +.sp +.ne 2 +.na +\fBl2bytes \fR +.ad +.RS 14n +bytes read per second from the L2ARC +.RE + +.sp +.ne 2 +.na +\fBl2miss% \fR +.ad +.RS 14n +L2ARC access miss percentage +.RE + +.sp +.ne 2 +.na +\fBl2asize \fR +.ad +.RS 14n +Actual (compressed) size of the L2ARC +.RE +.\" + +.SH OPTIONS +.LP +The following options are supported: + +.sp +.ne 2 +.na +\fB\fB-f\fR\fR +.ad +.RS 12n +Display only specific fields. See \fBDESCRIPTION\fR for supported statistics. +.RE + +.sp +.ne 2 +.na +\fB\fB-h\fR\fR +.ad +.RS 12n +Display help message. +.RE + +.sp +.ne 2 +.na +\fB\fB-o\fR\fR +.ad +.RS 12n +Report statistics to a file instead of the standard output. +.RE + +.sp +.ne 2 +.na +\fB\fB-s\fR\fR +.ad +.RS 12n +Display data with a specified separator (default: 2 spaces). +.RE + +.sp +.ne 2 +.na +\fB\fB-x\fR\fR + +.ad +.RS 12n +Print extended stats (same as -f time,mfu,mru,mfug,mrug,eskip,mtxmis,dread,pread,read). +.RE + +.sp +.ne 2 +.na +\fB\fB-v\fR\fR +.ad +.RS 12n +Show field headers and definitions +.RE + +.SH OPERANDS +.LP +The following operands are supported: +.sp +.ne 2 +.na +\fB\fIcount\fR\fR +.ad +.RS 12n +Display only \fIcount\fR reports. +.RE + +.sp +.ne 2 +.na +\fB\fIinterval\fR\fR +.ad +.RS 12n +Specify the sampling interval in seconds. +.RE + +.SH AUTHORS +.LP +arcstat was originally written by Neelakanth Nadgir and supported only ZFS ARC statistics. +Mike Harsch updated it to support L2ARC statistics. From a16f00212c3a60e6365152e60586ac11ae377215 Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Mon, 4 May 2020 03:49:33 -0400 Subject: [PATCH 3/4] Fix up arcstat(1) to match our version Turns out the illumos manpage, which is what this originates from, was written for the original Perl version of the utility which is not the version in the OpenZFS tree. *That* version originates from a Python rewrite that was done for FreeNAS. So fix up the manpage to match what we actually ship (and fix a few typos in the process). Signed-off-by: AJ Jordan Ref #10287 --- man/man1/Makefile.am | 2 +- man/man1/arcstat.1 | 63 +++++++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am index 2af917fa5c2e..de54328617eb 100644 --- a/man/man1/Makefile.am +++ b/man/man1/Makefile.am @@ -1,4 +1,4 @@ -dist_man_MANS = zhack.1 ztest.1 raidz_test.1 zvol_wait.1 +dist_man_MANS = zhack.1 ztest.1 raidz_test.1 zvol_wait.1 arcstat.1 EXTRA_DIST = cstyle.1 install-data-local: diff --git a/man/man1/arcstat.1 b/man/man1/arcstat.1 index f65095fe57dc..6dcc39b67f2f 100644 --- a/man/man1/arcstat.1 +++ b/man/man1/arcstat.1 @@ -11,15 +11,15 @@ .\" .\" Copyright 2014 Adam Stevko. All rights reserved. .\" Copyright (c) 2015 by Delphix. All rights reserved. +.\" Copyright (c) 2020 by AJ Jordan. All rights reserved. .\" -.TH ARCSTAT 1M "Feb 4, 2014" +.TH ARCSTAT 1 "May 7, 2020" .SH NAME arcstat \- report ZFS ARC and L2ARC statistics .SH SYNOPSIS .LP .nf -\fBarcstat\fR [\fB-hvxr\fR] [\fB-f field[,field]...\fR] [\fB-o file\fR] [\fB-s string\fR] - [\fBinterval\fR [\fBcount\fR]] +\fBarcstat\fR [\fB-hvx\fR] [\fB-f field[,field]...\fR] [\fB-o file\fR] [\fB-s string\fR] [\fBinterval\fR [\fBcount\fR]] .fi .SH DESCRIPTION @@ -36,12 +36,12 @@ The \fBarcstat\fR command reports the following information: .\" .sp -.ne 1 +.ne 1 .na \fBc \fR .ad .RS 14n -ARC Target Size +ARC target size .RE .sp @@ -50,7 +50,7 @@ ARC Target Size \fBdh% \fR .ad .RS 14n -Demand Data hit percentage +Demand data hit percentage .RE .sp @@ -59,7 +59,7 @@ Demand Data hit percentage \fBdm% \fR .ad .RS 14n -Demand Data miss percentage +Demand data miss percentage .RE .sp @@ -68,7 +68,7 @@ Demand Data miss percentage \fBmfu \fR .ad .RS 14n -MFU List hits per second +MFU list hits per second .RE .sp @@ -95,7 +95,7 @@ Metadata miss percentage \fBmru \fR .ad .RS 14n -MRU List hits per second +MRU list hits per second .RE .sp @@ -122,7 +122,7 @@ Prefetch miss percentage \fBdhit \fR .ad .RS 14n -Demand Data hits per second +Demand data hits per second .RE .sp @@ -131,7 +131,7 @@ Demand Data hits per second \fBdmis \fR .ad .RS 14n -Demand Data misses per second +Demand data misses per second .RE .sp @@ -140,7 +140,7 @@ Demand Data misses per second \fBhit% \fR .ad .RS 14n -ARC Hit percentage +ARC hit percentage .RE .sp @@ -158,7 +158,7 @@ ARC reads per second \fBmfug \fR .ad .RS 14n -MFU Ghost List hits per second +MFU ghost list hits per second .RE .sp @@ -194,7 +194,7 @@ Metadata misses per second \fBmrug \fR .ad .RS 14n -MRU Ghost List hits per second +MRU ghost list hits per second .RE .sp @@ -239,7 +239,7 @@ Time \fBarcsz \fR .ad .RS 14n -ARC Size +ARC size .RE .sp @@ -347,7 +347,7 @@ mutex_miss per second \fBl2bytes \fR .ad .RS 14n -bytes read per second from the L2ARC +Bytes read per second from the L2ARC .RE .sp @@ -367,6 +367,33 @@ L2ARC access miss percentage .RS 14n Actual (compressed) size of the L2ARC .RE + +.sp +.ne 2 +.na +\fBgrow \fR +.ad +.RS 14n +ARC grow disabled +.RE + +.sp +.ne 2 +.na +\fBneed \fR +.ad +.RS 14n +ARC reclaim needed +.RE + +.sp +.ne 2 +.na +\fBfree \fR +.ad +.RS 14n +ARC free memory +.RE .\" .SH OPTIONS @@ -413,7 +440,6 @@ Display data with a specified separator (default: 2 spaces). .ne 2 .na \fB\fB-x\fR\fR - .ad .RS 12n Print extended stats (same as -f time,mfu,mru,mfug,mrug,eskip,mtxmis,dread,pread,read). @@ -451,5 +477,6 @@ Specify the sampling interval in seconds. .SH AUTHORS .LP -arcstat was originally written by Neelakanth Nadgir and supported only ZFS ARC statistics. +arcstat was originally written in Perl by Neelakanth Nadgir and supported only ZFS ARC statistics. Mike Harsch updated it to support L2ARC statistics. +John Hixson ported it to Python for FreeNAS over some beer, after which many individuals from the OpenZFS community continued to maintain and improve it. From e022fb97239bf68d468e3c80896485b651f5ed71 Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Mon, 4 May 2020 04:00:59 -0400 Subject: [PATCH 4/4] Fix outdated comment header Signed-off-by: AJ Jordan --- cmd/arcstat/arcstat | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cmd/arcstat/arcstat b/cmd/arcstat/arcstat index ecdbfafe3a3f..df2f62d6b29f 100755 --- a/cmd/arcstat/arcstat +++ b/cmd/arcstat/arcstat @@ -1,20 +1,25 @@ #!/usr/bin/env python3 # # Print out ZFS ARC Statistics exported via kstat(1) -# For a definition of fields, or usage, use arctstat.pl -v +# For a definition of fields, or usage, use arcstat -v # -# This script is a fork of the original arcstat.pl (0.1) by -# Neelakanth Nadgir, originally published on his Sun blog on +# This script was originally a fork of the original arcstat.pl (0.1) +# by Neelakanth Nadgir, originally published on his Sun blog on # 09/18/2007 # http://blogs.sun.com/realneel/entry/zfs_arc_statistics # -# This version aims to improve upon the original by adding features -# and fixing bugs as needed. This version is maintained by -# Mike Harsch and is hosted in a public open source repository: +# A new version aimed to improve upon the original by adding features +# and fixing bugs as needed. This version was maintained by Mike +# Harsch and was hosted in a public open source repository: # http://github.com/mharsch/arcstat # -# Comments, Questions, or Suggestions are always welcome. -# Contact the maintainer at ( mike at harschsystems dot com ) +# but has since moved to the illumos-gate repository. +# +# This Python port was written by John Hixson for FreeNAS, introduced +# in commit e2c29f: +# https://github.com/freenas/freenas +# +# and has been improved by many people since. # # CDDL HEADER START #