Skip to content

Commit

Permalink
Changed decimals to integers in the arcstat script
Browse files Browse the repository at this point in the history
Changed interval value type from decimal to integer,
because of deprecation warning in Python 3.8 and above.
Also changed kstat values type from decimal to integer,
because all the values are integers.

Fixed behavior of arcstat when run without args.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Bartosz Zieba <bartosz@zieba.pro>
Closes #10132 
Closes #10142
  • Loading branch information
Avatat authored Mar 18, 2020
1 parent 5351951 commit 4df8b2c
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions cmd/arcstat/arcstat
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import getopt
import re
import copy

from decimal import Decimal
from signal import signal, SIGINT, SIGWINCH, SIG_DFL


Expand Down Expand Up @@ -139,7 +138,7 @@ if sys.platform.startswith('freebsd'):

name, value = s.name, s.value
# Trims 'kstat.zfs.misc.arcstats' from the name
kstat[name[24:]] = Decimal(value)
kstat[name[24:]] = int(value)

elif sys.platform.startswith('linux'):
def kstat_update():
Expand All @@ -158,7 +157,7 @@ elif sys.platform.startswith('linux'):
continue

name, unused, value = s.split()
kstat[name] = Decimal(value)
kstat[name] = int(value)


def detailed_usage():
Expand Down Expand Up @@ -335,16 +334,8 @@ def init():
i += 1

argv = sys.argv[i:]
sint = Decimal(argv[0]) if argv else sint
count = int(argv[1]) if len(argv) > 1 else count

if len(argv) > 1:
sint = Decimal(argv[0])
count = int(argv[1])

elif len(argv) > 0:
sint = Decimal(argv[0])
count = 0
sint = int(argv[0]) if argv else sint
count = int(argv[1]) if len(argv) > 1 else (0 if len(argv) > 0 else 1)

if hflag or (xflag and desired_cols):
usage()
Expand Down

0 comments on commit 4df8b2c

Please sign in to comment.