in report/generate_report.py [0:0]
def _get_proportion_breakdown(aggr_json_profile):
bazel_commit_to_phases = {}
for entry in aggr_json_profile:
bazel_commit = entry["bazel_source"]
if bazel_commit not in bazel_commit_to_phases:
bazel_commit_to_phases[bazel_commit] = []
bazel_commit_to_phases[bazel_commit].append({
"name": entry["name"],
"dur": entry["dur"]
})
bazel_commit_to_phase_proportion = {}
for bazel_commit in bazel_commit_to_phases.keys():
total_time = sum(
[float(entry["dur"]) for entry in bazel_commit_to_phases[bazel_commit]])
bazel_commit_to_phase_proportion[bazel_commit] = {
entry["name"]: float(entry["dur"]) / total_time
for entry in bazel_commit_to_phases[bazel_commit]
}
return bazel_commit_to_phase_proportion