def generate_report(all_remarks, file_remarks, source_dir, output_dir, should_display_hotness, num_jobs, should_print_progress): try: os.makedirs(output_dir) except OSError as e: if e.errno == errno.EEXIST and os.path.isdir(output_dir): pass else: raise _render_file_bound = functools.partial(_render_file, source_dir, output_dir, context) if should_print_progress: print('Rendering HTML files...') optpmap.pmap(_render_file_bound, file_remarks.items(), num_jobs, should_print_progress) if should_display_hotness: sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.Hotness, r.File, r.Line, r.Column, r. PassWithDiffPrefix, r.yaml_tag, r.Function), reverse=True) else: sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r. PassWithDiffPrefix, r.yaml_tag, r.Function)) IndexRenderer(args.output_dir, should_display_hotness).render(sorted_remarks) shutil.copy( os.path.join(os.path.dirname(os.path.realpath(__file__)), "style.css"), output_dir)
def generate_report(all_remarks, file_remarks, source_dir, output_dir, should_display_hotness, num_jobs, should_print_progress): try: os.makedirs(output_dir) except OSError as e: if e.errno == errno.EEXIST and os.path.isdir(output_dir): pass else: raise _render_file_bound = functools.partial(_render_file, source_dir, output_dir, context) if should_print_progress: print('Rendering HTML files...') optpmap.pmap(_render_file_bound, file_remarks.items(), num_jobs, should_print_progress) if should_display_hotness: sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.Hotness, r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function), reverse=True) else: sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function)) IndexRenderer(args.output_dir).render(sorted_remarks) shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)), "style.css"), output_dir)
def map_remarks(all_remarks): # Set up a map between function names and their source location for # function where inlining happened for remark in optrecord.itervalues(all_remarks): if isinstance(remark, optrecord.Passed) and remark.Pass == "inline" and remark.Name == "Inlined": for arg in remark.Args: caller = arg.get('Caller') if caller: context.caller_loc[caller] = arg['DebugLoc']
def map_remarks(all_remarks): # Set up a map between function names and their source location for # function where inlining happened for remark in optrecord.itervalues(all_remarks): if isinstance( remark, optrecord.Passed ) and remark.Pass == "inline" and remark.Name == "Inlined": for arg in remark.Args: caller = arg.get('Caller') if caller: context.caller_loc[caller] = arg['DebugLoc']
print_progress = not args.no_progress_indicator files = optrecord.find_opt_files(*args.yaml_dirs_or_files) if not files: parser.error("No *.opt.yaml files found") sys.exit(1) all_remarks, file_remarks, _ = optrecord.gather_results( files, args.jobs, print_progress) if print_progress: print('\n') bypass = defaultdict(int) byname = defaultdict(int) for r in optrecord.itervalues(all_remarks): bypass[r.Pass] += 1 byname[r.Pass + "/" + r.Name] += 1 total = len(all_remarks) print("{:24s} {:10d}".format("Total number of remarks", total)) if hp: h = hp.heap() print("{:24s} {:10d}".format("Memory per remark", h.size / len(all_remarks))) print('\n') print("Top 10 remarks by pass:"******" {:30s} {:2.0f}%". format(passname, count * 100. / total))
print_progress = not args.no_progress_indicator files = optrecord.find_opt_files(*args.yaml_dirs_or_files) if not files: parser.error("No *.opt.yaml files found") sys.exit(1) all_remarks, file_remarks, _ = optrecord.gather_results( files, args.jobs, print_progress) if print_progress: print('\n') bypass = defaultdict(int) byname = defaultdict(int) for r in optrecord.itervalues(all_remarks): bypass[r.Pass] += 1 byname[r.Pass + "/" + r.Name] += 1 total = len(all_remarks) print("{:24s} {:10d}".format("Total number of remarks", total)) if hp: h = hp.heap() print("{:24s} {:10d}".format("Memory per remark", h.size / len(all_remarks))) print('\n') print("Top 10 remarks by pass:") for (passname, count) in sorted(bypass.items(), key=operator.itemgetter(1), reverse=True)[:10]: