Lines Matching +full:num +full:- +full:cols
2 # SPDX-License-Identifier: CDDL-1.0
15 # or https://opensource.org/licenses/CDDL-1.0.
39 cols = {
41 "time": [8, -1, "time"],
42 "pool": [12, -1, "pool"],
43 "ds": [12, -1, "dataset_name"],
44 "obj": [12, -1, "objset"],
87 cmd = ("Usage: zilstat [-hgdv] [-i interval] [-p pool_name]")
100 def prettynum(sz, scale, num=0):
105 if scale == -1:
106 return "%*s" % (sz, num)
109 elif 0 < num < 1:
110 num = 0
112 while num > scale and index < 5:
113 save = num
114 num = num / scale
118 return "%*d" % (sz, num)
121 return "%*.1f%s" % (sz - 1, num, suffix[index])
123 return "%*d%s" % (sz - 1, num, suffix[index])
130 if interval > 0 and cols[col][1] > 100:
132 sys.stdout.write("%*s%s" % (cols[col][0], new_col, sep))
139 val = v[cols[col][2]]
140 if interval > 0 and cols[col][1] > 100:
141 val = v[cols[col][2]] // interval
143 prettynum(cols[col][0], cols[col][1], val), sep))
154 for key in cols:
155 sys.stderr.write("%11s : %s\n" % (key, cols[key][2]))
176 "\tzilstat -a\n"\
177 '\tzilstat -v\n'\
178 '\tzilstat -p tank\n'\
179 '\tzilstat -d tank/d1,tank/d2,tank/zv1\n'\
180 '\tzilstat -i 1\n'\
181 '\tzilstat -s \"***\"\n'\
182 '\tzilstat -f zcwc,zimnb,zimsb\n')
185 "-v", "--verbose",
193 "-a", "--all",
200 "-p", "--pool",
206 "-d", "--dataset",
212 "-f", "--columns",
214 help="Specify specific fields to print (see -v)"
218 "-s", "--separator",
225 "-i", "--interval",
262 if ele not in cols:
266 sys.stderr.write("Invalid column definition! -- %s\n" % invalid)
281 # Requires py-sysctl on FreeBSD
293 file = "kstat.zfs." + pool + ".dataset.objset-" + objid
304 if not s or (s.name.find("zil") == -1 and \
305 s.name.find("dataset_name") == -1):
308 objid = re.findall(r'0x[0-9A-F]+', \
312 zil_start = len(file + ".objset-" + \
325 if not s or (s.name.find("zil") == -1 and \
326 s.name.find("dataset_name") == -1):
341 file = "/proc/spl/kstat/zfs/" + pool + "/objset-" + objid
350 if objid.find("objset-") == -1:
354 kstat_process_str(k, file, objid.replace("objset-", ""))
364 if not s or (s.find("zil") == -1 and \
365 s.find("dataset_name") == -1):
389 'list', '-Hpo', 'objsetid', ds], \
391 .decode('utf-8').strip()
393 print("Command: \"zfs list -Hpo objset "\
409 pools = subprocess.check_output(['zpool', 'list', '-Hpo',\
410 'name']).decode('utf-8').split()
412 print("Command: \"zpool list -Hpo name\" failed with error"\
436 - prev[pool][objset][key]