Lines Matching +full:num +full:- +full:cols
2 # SPDX-License-Identifier: CDDL-1.0
5 # For a definition of fields, or usage, use arcstat -v
17 # but has since moved to the illumos-gate repository.
33 # or https://opensource.org/licenses/CDDL-1.0.
63 cols = {
65 "time": [8, -1, "Time"],
246 cols[colname] = [len(colname), 1024, coldesc]
248 cols[colname + "%"] = [len(colname) + 1, 100, \
264 cmd = ("Usage: arcstat [-havxp] [-f fields] [-o file] [-s string] [interval "
274 # Requires py-sysctl on FreeBSD
330 for key in cols:
331 sys.stderr.write("%11s : %s\n" % (key, cols[key][2]))
339 sys.stderr.write("\t -h : Print this help message\n")
340 sys.stderr.write("\t -a : Print all possible stats\n")
341 sys.stderr.write("\t -v : List all possible field headers and definitions"
343 sys.stderr.write("\t -x : Print extended stats\n")
344 sys.stderr.write("\t -z : Print zfetch stats\n")
345 sys.stderr.write("\t -f : Specify specific fields to print (see -v)\n")
346 sys.stderr.write("\t -o : Redirect output to the specified file\n")
347 sys.stderr.write("\t -s : Override default field separator with custom "
349 sys.stderr.write("\t -p : Disable auto-scaling of numerical fields\n")
351 sys.stderr.write("\tarcstat -o /tmp/a.log 2 10\n")
352 sys.stderr.write("\tarcstat -s \",\" -o /tmp/a.log 2 10\n")
353 sys.stderr.write("\tarcstat -v\n")
354 sys.stderr.write("\tarcstat -f time,hit%,dh%,ph%,mh% 1\n")
377 v = (s-int(pd))*(s-int(meta))/s
379 v = (s-int(pm))*int(meta)/s
381 v = int(pd)*(s-int(meta))/s
395 d[key] = cur[key] - prev[key]
400 def isint(num):
401 if isinstance(num, float):
402 return num.is_integer()
403 if isinstance(num, int):
408 def prettynum(sz, scale, num=0):
413 if scale == -1:
414 return "%s" % num
417 while abs(num) > scale and index < 5:
418 num = num / scale
421 width = sz - (0 if index == 0 else 1)
422 intlen = len("%.0f" % num) # %.0f rounds to nearest int
423 if sint == 1 and isint(num) or width < intlen + 2:
427 return "%*.*f%s" % (width, decimal, num, suffix[index])
437 fmt = lambda col: prettynum(cols[col][0], cols[col][1], v[col])
452 fmt = lambda col: "%*s" % (cols[col][0], col)
477 hdr_intr = lines - 3
526 if opt in ('-a', '--all'):
528 if opt in ('-x', '--extended'):
530 if opt in ('-o', '--outfile'):
533 if opt in ('-h', '--help'):
535 if opt in ('-v', '--verbose'):
537 if opt in ('-s', '--separator'):
540 if opt in ('-f', '--columns'):
543 if opt in ('-p', '--parsable'):
545 if opt in ('-z', '--zfetch'):
579 if ele not in cols:
586 sys.stderr.write("Invalid column definition! -- %s\n" % invalid)
590 sys.stderr.write("Incompatible field specified! -- %s\n" %
596 hdr = cols.keys()
598 hdr = [col for col in cols.keys() if not col.startswith("l2")]
623 v["miss%"] = 100 - v["hit%"] - v["ioh%"] if v["read"] > 0 else 0
632 v["dm%"] = 100 - v["dh%"] - v["di%"] if v["dread"] > 0 else 0
641 v["ddm%"] = 100 - v["ddh%"] - v["ddi%"] if v["ddread"] > 0 else 0
650 v["dmm%"] = 100 - v["dmh%"] - v["dmi%"] if v["dmread"] > 0 else 0
661 v["pm%"] = 100 - v["ph%"] - v["pi%"] if v["pread"] > 0 else 0
670 v["pdm%"] = 100 - v["pdh%"] - v["pdi%"] if v["pdread"] > 0 else 0
679 v["pmm%"] = 100 - v["pmh%"] - v["pmi%"] if v["pmread"] > 0 else 0
691 v["mm%"] = 100 - v["mh%"] - v["mi%"] if v["mread"] > 0 else 0
744 v["l2miss%"] = 100 - v["l2hit%"] if v["l2read"] > 0 else 0
793 count -= 1