def discover_and_make_plots(destination_prefix, github_urlbase):
with open(os.path.join(os.path.dirname(__file__), 'index.tmpl.html')) as f:
index_template = Template(f.read())
benchmark_pages = defaultdict(list)
index_page = os.path.join(destination_prefix, 'index.html')
for root, dirs, files in os.walk(destination_prefix):
output_subdir = os.path.relpath(root, destination_prefix)
results_filename = os.path.join(root, 'results.json')
plot_filename = os.path.join(root, 'results.html')
github_url = github_urlbase + '/' + output_subdir
if os.path.exists(results_filename):
print(' Found: %s' % results_filename)
results = generate_plots(results_filename, plot_filename, github_url=github_url)
benchmark_pages[os.path.dirname(output_subdir)].append(dict(name=results['name'], path=os.path.join(output_subdir, 'results.html')))
# Generate index page
with open(index_page, 'w') as f:
f.write(index_template.render(sections=benchmark_pages))
评论列表
文章目录