Several tweaks to script flags
- Changed multi-field flags to action=append instead of comma-separated. - Dropped short-names for geometries/powerlosses - Renamed -Pexponential -> -Plog - Allowed omitting the 0 for -W0/-H0/-n0 and made -j0 consistent - Better handling of --xlim/--ylim
This commit is contained in:
+9
-6
@@ -511,7 +511,7 @@ def find_runner(runner, **args):
|
||||
|
||||
# other context
|
||||
if args.get('geometry'):
|
||||
cmd.append('-g%s' % args['geometry'])
|
||||
cmd.append('-G%s' % args['geometry'])
|
||||
if args.get('disk'):
|
||||
cmd.append('-d%s' % args['disk'])
|
||||
if args.get('trace'):
|
||||
@@ -1003,6 +1003,10 @@ def run(runner, bench_ids=[], **args):
|
||||
total_perms))
|
||||
print()
|
||||
|
||||
# automatic job detection?
|
||||
if args.get('jobs') == 0:
|
||||
args['jobs'] = len(os.sched_getaffinity(0))
|
||||
|
||||
# truncate and open logs here so they aren't disconnected between benches
|
||||
stdout = None
|
||||
if args.get('stdout'):
|
||||
@@ -1246,9 +1250,8 @@ if __name__ == "__main__":
|
||||
action='append',
|
||||
help="Override a bench define.")
|
||||
bench_parser.add_argument(
|
||||
'-g', '--geometry',
|
||||
help="Comma-separated list of disk geometries to bench. "
|
||||
"Defaults to d,e,E,n,N.")
|
||||
'-G', '--geometry',
|
||||
help="Comma-separated list of disk geometries to bench.")
|
||||
bench_parser.add_argument(
|
||||
'-d', '--disk',
|
||||
help="Direct block device operations to this file.")
|
||||
@@ -1274,8 +1277,8 @@ if __name__ == "__main__":
|
||||
'-j', '--jobs',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=len(os.sched_getaffinity(0)),
|
||||
help="Number of parallel runners to run.")
|
||||
const=0,
|
||||
help="Number of parallel runners to run. 0 runs one runner per core.")
|
||||
bench_parser.add_argument(
|
||||
'-k', '--keep-going',
|
||||
action='store_true',
|
||||
|
||||
+31
-25
@@ -479,8 +479,8 @@ def main(csv_paths, *,
|
||||
x=None,
|
||||
y=None,
|
||||
define=[],
|
||||
xlim=None,
|
||||
ylim=None,
|
||||
xlim=(None,None),
|
||||
ylim=(None,None),
|
||||
width=None,
|
||||
height=17,
|
||||
cat=False,
|
||||
@@ -489,7 +489,7 @@ def main(csv_paths, *,
|
||||
colors=None,
|
||||
chars=None,
|
||||
line_chars=None,
|
||||
no_lines=False,
|
||||
points=False,
|
||||
legend=None,
|
||||
keep_open=False,
|
||||
sleep=None,
|
||||
@@ -503,9 +503,9 @@ def main(csv_paths, *,
|
||||
color = False
|
||||
|
||||
# allow shortened ranges
|
||||
if xlim is not None and len(xlim) == 1:
|
||||
if len(xlim) == 1:
|
||||
xlim = (0, xlim[0])
|
||||
if ylim is not None and len(ylim) == 1:
|
||||
if len(ylim) == 1:
|
||||
ylim = (0, ylim[0])
|
||||
|
||||
# separate out renames
|
||||
@@ -544,7 +544,7 @@ def main(csv_paths, *,
|
||||
|
||||
if line_chars is not None:
|
||||
line_chars_ = line_chars
|
||||
elif not no_lines:
|
||||
elif not points:
|
||||
line_chars_ = [True]
|
||||
else:
|
||||
line_chars_ = [False]
|
||||
@@ -567,28 +567,26 @@ def main(csv_paths, *,
|
||||
legend_width = max(legend_width, len(label)+1)
|
||||
|
||||
# find xlim/ylim
|
||||
if xlim is not None:
|
||||
xlim_ = xlim
|
||||
else:
|
||||
xlim_ = (
|
||||
min(it.chain([0], (k
|
||||
xlim_ = (
|
||||
xlim[0] if xlim[0] is not None
|
||||
else min(it.chain([0], (k
|
||||
for r in datasets_.values()
|
||||
for k, v in r.items()
|
||||
if v is not None))),
|
||||
max(it.chain([0], (k
|
||||
xlim[1] if xlim[1] is not None
|
||||
else max(it.chain([0], (k
|
||||
for r in datasets_.values()
|
||||
for k, v in r.items()
|
||||
if v is not None))))
|
||||
|
||||
if ylim is not None:
|
||||
ylim_ = ylim
|
||||
else:
|
||||
ylim_ = (
|
||||
min(it.chain([0], (v
|
||||
ylim_ = (
|
||||
ylim[0] if ylim[0] is not None
|
||||
else min(it.chain([0], (v
|
||||
for r in datasets_.values()
|
||||
for _, v in r.items()
|
||||
if v is not None))),
|
||||
max(it.chain([0], (v
|
||||
ylim[1] if ylim[1] is not None
|
||||
else max(it.chain([0], (v
|
||||
for r in datasets_.values()
|
||||
for _, v in r.items()
|
||||
if v is not None))))
|
||||
@@ -740,17 +738,17 @@ if __name__ == "__main__":
|
||||
"or list of paths. Defaults to %r." % CSV_PATHS)
|
||||
parser.add_argument(
|
||||
'-b', '--by',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Fields to render as separate plots. All other fields will be "
|
||||
"summed as needed. Can rename fields with new_name=old_name.")
|
||||
parser.add_argument(
|
||||
'-x',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Fields to use for the x-axis. Can rename fields with "
|
||||
"new_name=old_name.")
|
||||
parser.add_argument(
|
||||
'-y',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Fields to use for the y-axis. Can rename fields with "
|
||||
"new_name=old_name.")
|
||||
parser.add_argument(
|
||||
@@ -771,7 +769,7 @@ if __name__ == "__main__":
|
||||
"sometimes suffer from inconsistent widths.")
|
||||
parser.add_argument(
|
||||
'--colors',
|
||||
type=lambda x: x.split(','),
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
help="Colors to use.")
|
||||
parser.add_argument(
|
||||
'--chars',
|
||||
@@ -780,17 +778,21 @@ if __name__ == "__main__":
|
||||
'--line-chars',
|
||||
help="Characters to use for lines.")
|
||||
parser.add_argument(
|
||||
'-L', '--no-lines',
|
||||
'-.', '--points',
|
||||
action='store_true',
|
||||
help="Only draw the data points.")
|
||||
parser.add_argument(
|
||||
'-W', '--width',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Width in columns. 0 uses the terminal width. Defaults to "
|
||||
"min(terminal, 80).")
|
||||
parser.add_argument(
|
||||
'-H', '--height',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Height in rows. 0 uses the terminal height. Defaults to 17.")
|
||||
parser.add_argument(
|
||||
'-z', '--cat',
|
||||
@@ -798,11 +800,15 @@ if __name__ == "__main__":
|
||||
help="Pipe directly to stdout.")
|
||||
parser.add_argument(
|
||||
'-X', '--xlim',
|
||||
type=lambda x: tuple(dat(x) if x else None for x in x.split(',')),
|
||||
type=lambda x: tuple(
|
||||
dat(x) if x.strip() else None
|
||||
for x in x.split(',')),
|
||||
help="Range for the x-axis.")
|
||||
parser.add_argument(
|
||||
'-Y', '--ylim',
|
||||
type=lambda x: tuple(dat(x) if x else None for x in x.split(',')),
|
||||
type=lambda x: tuple(
|
||||
dat(x) if x.strip() else None
|
||||
for x in x.split(',')),
|
||||
help="Range for the y-axis.")
|
||||
parser.add_argument(
|
||||
'--xlog',
|
||||
|
||||
+10
-10
@@ -671,46 +671,46 @@ if __name__ == "__main__":
|
||||
help="Only show percentage change, not a full diff.")
|
||||
parser.add_argument(
|
||||
'-b', '--by',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Group by these fields. All other fields will be merged as "
|
||||
"needed. Can rename fields with new_name=old_name.")
|
||||
parser.add_argument(
|
||||
'-f', '--fields',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Use these fields. Can rename fields with new_name=old_name.")
|
||||
parser.add_argument(
|
||||
'-D', '--define',
|
||||
type=lambda x: (lambda k,v: (k, set(v.split(','))))(*x.split('=', 1)),
|
||||
action='append',
|
||||
type=lambda x: (lambda k,v: (k, set(v.split(','))))(*x.split('=', 1)),
|
||||
help="Only include rows where this field is this value. May include "
|
||||
"comma-separated options.")
|
||||
parser.add_argument(
|
||||
'--add',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Add these fields (the default).")
|
||||
parser.add_argument(
|
||||
'--mul',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Multiply these fields.")
|
||||
parser.add_argument(
|
||||
'--min',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Take the minimum of these fields.")
|
||||
parser.add_argument(
|
||||
'--max',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Take the maximum of these fields.")
|
||||
parser.add_argument(
|
||||
'--avg',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Average these fields.")
|
||||
parser.add_argument(
|
||||
'-s', '--sort',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Sort by these fields.")
|
||||
parser.add_argument(
|
||||
'-S', '--reverse-sort',
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
action='append',
|
||||
help="Sort by these fields, but backwards.")
|
||||
parser.add_argument(
|
||||
'-Y', '--summary',
|
||||
|
||||
+3
-2
@@ -121,9 +121,10 @@ if __name__ == "__main__":
|
||||
nargs='?',
|
||||
help="Path to read from.")
|
||||
parser.add_argument(
|
||||
'-n',
|
||||
'--lines',
|
||||
'-n', '--lines',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Show this many lines of history. 0 uses the terminal height. "
|
||||
"Defaults to 5.")
|
||||
parser.add_argument(
|
||||
|
||||
+12
-10
@@ -525,9 +525,9 @@ def find_runner(runner, **args):
|
||||
|
||||
# other context
|
||||
if args.get('geometry'):
|
||||
cmd.append('-g%s' % args['geometry'])
|
||||
cmd.append('-G%s' % args['geometry'])
|
||||
if args.get('powerloss'):
|
||||
cmd.append('-p%s' % args['powerloss'])
|
||||
cmd.append('-P%s' % args['powerloss'])
|
||||
if args.get('disk'):
|
||||
cmd.append('-d%s' % args['disk'])
|
||||
if args.get('trace'):
|
||||
@@ -1009,6 +1009,10 @@ def run(runner, test_ids=[], **args):
|
||||
total_perms))
|
||||
print()
|
||||
|
||||
# automatic job detection?
|
||||
if args.get('jobs') == 0:
|
||||
args['jobs'] = len(os.sched_getaffinity(0))
|
||||
|
||||
# truncate and open logs here so they aren't disconnected between tests
|
||||
stdout = None
|
||||
if args.get('stdout'):
|
||||
@@ -1251,13 +1255,11 @@ if __name__ == "__main__":
|
||||
action='append',
|
||||
help="Override a test define.")
|
||||
test_parser.add_argument(
|
||||
'-g', '--geometry',
|
||||
help="Comma-separated list of disk geometries to test. "
|
||||
"Defaults to d,e,E,n,N.")
|
||||
'-G', '--geometry',
|
||||
help="Comma-separated list of disk geometries to test.")
|
||||
test_parser.add_argument(
|
||||
'-p', '--powerloss',
|
||||
help="Comma-separated list of power-loss scenarios to test. "
|
||||
"Defaults to 0,l.")
|
||||
'-P', '--powerloss',
|
||||
help="Comma-separated list of power-loss scenarios to test.")
|
||||
test_parser.add_argument(
|
||||
'-d', '--disk',
|
||||
help="Direct block device operations to this file.")
|
||||
@@ -1283,8 +1285,8 @@ if __name__ == "__main__":
|
||||
'-j', '--jobs',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=len(os.sched_getaffinity(0)),
|
||||
help="Number of parallel runners to run.")
|
||||
const=0,
|
||||
help="Number of parallel runners to run. 0 runs one runner per core.")
|
||||
test_parser.add_argument(
|
||||
'-k', '--keep-going',
|
||||
action='store_true',
|
||||
|
||||
+14
-4
@@ -853,11 +853,15 @@ if __name__ == "__main__":
|
||||
help="Render wear.")
|
||||
parser.add_argument(
|
||||
'-b', '--block',
|
||||
type=lambda x: tuple(int(x,0) if x else None for x in x.split(',',1)),
|
||||
type=lambda x: tuple(
|
||||
int(x, 0) if x.strip() else None
|
||||
for x in x.split(',')),
|
||||
help="Show a specific block or range of blocks.")
|
||||
parser.add_argument(
|
||||
'-i', '--off',
|
||||
type=lambda x: tuple(int(x,0) if x else None for x in x.split(',',1)),
|
||||
type=lambda x: tuple(
|
||||
int(x, 0) if x.strip() else None
|
||||
for x in x.split(',')),
|
||||
help="Show a specific offset or range of offsets.")
|
||||
parser.add_argument(
|
||||
'-B', '--block-size',
|
||||
@@ -901,24 +905,30 @@ if __name__ == "__main__":
|
||||
help="Characters to use for showing wear.")
|
||||
parser.add_argument(
|
||||
'--colors',
|
||||
type=lambda x: x.split(','),
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
help="Colors to use for read, prog, erase, noop operations.")
|
||||
parser.add_argument(
|
||||
'--wear-colors',
|
||||
type=lambda x: x.split(','),
|
||||
type=lambda x: [x.strip() for x in x.split(',')],
|
||||
help="Colors to use for showing wear.")
|
||||
parser.add_argument(
|
||||
'-W', '--width',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Width in columns. 0 uses the terminal width. Defaults to "
|
||||
"min(terminal, 80).")
|
||||
parser.add_argument(
|
||||
'-H', '--height',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Height in rows. 0 uses the terminal height. Defaults to 1.")
|
||||
parser.add_argument(
|
||||
'-n', '--lines',
|
||||
nargs='?',
|
||||
type=lambda x: int(x, 0),
|
||||
const=0,
|
||||
help="Show this many lines of history. 0 uses the terminal height. "
|
||||
"Defaults to 5.")
|
||||
parser.add_argument(
|
||||
|
||||
Reference in New Issue
Block a user