diff --git a/scripts/code.py b/scripts/code.py index f2a1a5d5..f2c647bd 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -1027,18 +1027,6 @@ def main(obj_paths, *, by=by, defines=defines) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], CodeResult, results, - by=by, - fields=fields, - **args) - if args.get('output_json'): - write_csv(args['output_json'], CodeResult, results, json=True, - by=by, - fields=fields, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1055,8 +1043,20 @@ def main(obj_paths, *, by=by, defines=defines) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], CodeResult, results, json=True, + by=by, + fields=fields, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], CodeResult, results, + by=by, + fields=fields, + **args) # print table - if not args.get('quiet'): + else: table(CodeResult, results, diff_results, by=by, fields=fields, @@ -1078,10 +1078,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/cov.py b/scripts/cov.py index 9619ea6d..729da94e 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -953,13 +953,17 @@ def main(gcda_paths, *, else: by = ['function'] - visible = None if fields is None: - fields = ['calls', 'hits', 'funcs', 'lines', 'branches'] - if not hits: - visible = ['lines', 'branches'] + if (args.get('annotate') + or args.get('lines') + or args.get('branches') + or args.get('output') + or args.get('output_json')): + fields = ['calls', 'hits', 'funcs', 'lines', 'branches'] + elif not hits: + fields = ['lines', 'branches'] else: - visible = ['calls', 'hits'] + fields = ['calls', 'hits'] # find sizes if not args.get('use', None): @@ -982,18 +986,6 @@ def main(gcda_paths, *, by=by, defines=defines) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], CovResult, results, - by=by, - fields=fields, - **args) - if args.get('output_json'): - write_csv(args['output_json'], CovResult, results, json=True, - by=by, - fields=fields, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1010,20 +1002,30 @@ def main(gcda_paths, *, by=by, defines=defines) + # annotate sources + if (args.get('annotate') + or args.get('lines') + or args.get('branches')): + annotate(CovResult, results, **args) + # write results to JSON + elif args.get('output_json'): + write_csv(args['output_json'], CovResult, results, json=True, + by=by, + fields=fields, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], CovResult, results, + by=by, + fields=fields, + **args) # print table - if not args.get('quiet'): - if (args.get('annotate') - or args.get('lines') - or args.get('branches')): - # annotate sources - annotate(CovResult, results, **args) - else: - # print table - table(CovResult, results, diff_results, - by=by, - fields=visible if visible is not None else fields, - sort=sort, - **args) + else: + table(CovResult, results, diff_results, + by=by, + fields=fields, + sort=sort, + **args) # catch lack of coverage if args.get('error_on_lines') and any( @@ -1048,10 +1050,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/csv.py b/scripts/csv.py index 69f8e868..6e09ebaa 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -2206,10 +2206,11 @@ def main(csv_paths, *, if by is not None: labels = [k for (k, v), hidden in by if not hidden] by = [k for (k, v), hidden in by] - visible = None if fields is not None: - visible = [k for (k, v), hidden in fields if not hidden] - fields = [k for (k, v), hidden in fields] + fields = [k for (k, v), hidden in fields + if not hidden + or args.get('output') + or args.get('output_json')] if sort is not None: sort = [(k, reverse) for (k, v), reverse in sort] if hot is not None: @@ -2293,20 +2294,6 @@ def main(csv_paths, *, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], Result, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], Result, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -2343,11 +2330,25 @@ def main(csv_paths, *, depth=depth, hot=hot) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], Result, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], Result, results, + by=by, + fields=fields, + depth=depth, + **args) # print table - if not args.get('quiet'): + else: table(Result, results, diff_results, by=by, - fields=visible if visible is not None else fields, + fields=fields, sort=sort, labels=labels, depth=depth, @@ -2372,10 +2373,6 @@ if __name__ == "__main__": '--help-exprs', action='store_true', help="Show what field exprs are available.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/ctx.py b/scripts/ctx.py index 29fde933..3a70577b 100755 --- a/scripts/ctx.py +++ b/scripts/ctx.py @@ -1268,10 +1268,12 @@ def main(obj_paths, *, else: by = ['function'] - visible = None if fields is None: - fields = ['off', 'size'] - visible = ['size'] + if (args.get('output') + or args.get('output_json')): + fields = ['off', 'size'] + else: + fields = ['size'] # figure out depth if depth is None: @@ -1309,20 +1311,6 @@ def main(obj_paths, *, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], CtxResult, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], CtxResult, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1347,11 +1335,25 @@ def main(obj_paths, *, depth=depth, hot=hot) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], CtxResult, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], CtxResult, results, + by=by, + fields=fields, + depth=depth, + **args) # print table - if not args.get('quiet'): + else: table(CtxResult, results, diff_results, by=by, - fields=visible if visible is not None else fields, + fields=fields, sort=sort, labels=labels, depth=depth, @@ -1372,10 +1374,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/data.py b/scripts/data.py index bcab260c..9d3c38b5 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -1027,18 +1027,6 @@ def main(obj_paths, *, by=by, defines=defines) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], DataResult, results, - by=by, - fields=fields, - **args) - if args.get('output_json'): - write_csv(args['output_json'], DataResult, results, json=True, - by=by, - fields=fields, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1055,8 +1043,20 @@ def main(obj_paths, *, by=by, defines=defines) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], DataResult, results, json=True, + by=by, + fields=fields, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], DataResult, results, + by=by, + fields=fields, + **args) # print table - if not args.get('quiet'): + else: table(DataResult, results, diff_results, by=by, fields=fields, @@ -1078,10 +1078,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/perf.py b/scripts/perf.py index 89e258f9..3a80bec6 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -1484,15 +1484,18 @@ def report(perf_paths, *, else: by = ['function'] - visible = None if fields is None: - fields = ['cycles', 'bmisses', 'branches', 'cmisses', 'caches'] - if not branches and not caches: - visible = ['cycles'] + if (args.get('annotate') + or args.get('threshold') + or args.get('output') + or args.get('output_json')): + fields = ['cycles', 'bmisses', 'branches', 'cmisses', 'caches'] + elif not branches and not caches: + fields = ['cycles'] elif branches: - visible = ['bmisses', 'branches'] + fields = ['bmisses', 'branches'] else: - visible = ['cmisses', 'caches'] + fields = ['cmisses', 'caches'] # figure out depth if depth is None: @@ -1530,20 +1533,6 @@ def report(perf_paths, *, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], PerfResult, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], PerfResult, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1569,23 +1558,35 @@ def report(perf_paths, *, hot=hot) # print table - if not args.get('quiet'): - if (args.get('annotate') - or args.get('threshold')): - # annotate sources - annotate(PerfResult, results, - branches=branches, - caches=caches, - **args) - else: - # print table - table(PerfResult, results, diff_results, - by=by, - fields=visible if visible is not None else fields, - sort=sort, - labels=labels, - depth=depth, - **args) + if (args.get('annotate') + or args.get('threshold')): + annotate(PerfResult, results, + branches=branches, + caches=caches, + **args) + # write results to JSON + elif args.get('output_json'): + write_csv(args['output_json'], PerfResult, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], PerfResult, results, + by=by, + fields=fields, + depth=depth, + **args) + else: + # print table + table(PerfResult, results, diff_results, + by=by, + fields=fields, + sort=sort, + labels=labels, + depth=depth, + **args) def main(**args): @@ -1621,10 +1622,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/perfbd.py b/scripts/perfbd.py index d81ee937..d2eb5392 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -1525,20 +1525,6 @@ def report(paths, *, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], PerfBdResult, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], PerfBdResult, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1564,23 +1550,35 @@ def report(paths, *, hot=hot) # print table - if not args.get('quiet'): - if (args.get('annotate') - or args.get('threshold') - or args.get('read_threshold') - or args.get('prog_threshold') - or args.get('erase_threshold')): - # annotate sources - annotate(PerfBdResult, results, **args) - else: - # print table - table(PerfBdResult, results, diff_results, - by=by, - fields=fields, - sort=sort, - labels=labels, - depth=depth, - **args) + if (args.get('annotate') + or args.get('threshold') + or args.get('read_threshold') + or args.get('prog_threshold') + or args.get('erase_threshold')): + annotate(PerfBdResult, results, **args) + # write results to JSON + elif args.get('output_json'): + write_csv(args['output_json'], PerfBdResult, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], PerfBdResult, results, + by=by, + fields=fields, + depth=depth, + **args) + # print table + else: + table(PerfBdResult, results, diff_results, + by=by, + fields=fields, + sort=sort, + labels=labels, + depth=depth, + **args) def main(**args): @@ -1621,10 +1619,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/stack.py b/scripts/stack.py index e9c16903..d33c33ad 100755 --- a/scripts/stack.py +++ b/scripts/stack.py @@ -1053,20 +1053,6 @@ def main(ci_paths, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], StackResult, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], StackResult, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1091,8 +1077,22 @@ def main(ci_paths, depth=depth, hot=hot) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], StackResult, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], StackResult, results, + by=by, + fields=fields, + depth=depth, + **args) # print table - if not args.get('quiet'): + else: table(StackResult, results, diff_results, by=by, fields=fields, @@ -1121,10 +1121,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.") diff --git a/scripts/structs.py b/scripts/structs.py index 4e1e3d5e..17206504 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -1088,10 +1088,12 @@ def main(obj_paths, *, else: by = ['struct'] - visible = None if fields is None: - fields = ['off', 'size', 'align'] - visible = ['size', 'align'] + if (args.get('output') + or args.get('output_json')): + fields = ['off', 'size', 'align'] + else: + fields = ['size', 'align'] # figure out depth if depth is None: @@ -1129,20 +1131,6 @@ def main(obj_paths, *, depth=depth, hot=hot) - # write results to CSV/JSON - if args.get('output'): - write_csv(args['output'], StructResult, results, - by=by, - fields=fields, - depth=depth, - **args) - if args.get('output_json'): - write_csv(args['output_json'], StructResult, results, json=True, - by=by, - fields=fields, - depth=depth, - **args) - # find previous results? diff_results = None if args.get('diff') or args.get('percent'): @@ -1167,11 +1155,25 @@ def main(obj_paths, *, depth=depth, hot=hot) + # write results to JSON + if args.get('output_json'): + write_csv(args['output_json'], StructResult, results, json=True, + by=by, + fields=fields, + depth=depth, + **args) + # write results to CSV + elif args.get('output'): + write_csv(args['output'], StructResult, results, + by=by, + fields=fields, + depth=depth, + **args) # print table - if not args.get('quiet'): + else: table(StructResult, results, diff_results, by=by, - fields=visible if visible is not None else fields, + fields=fields, sort=sort, labels=labels, depth=depth, @@ -1192,10 +1194,6 @@ if __name__ == "__main__": '-v', '--verbose', action='store_true', help="Output commands that run behind the scenes.") - parser.add_argument( - '-q', '--quiet', - action='store_true', - help="Don't show anything, useful with -o.") parser.add_argument( '-o', '--output', help="Specify CSV file to store results.")