X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Fbabeltrace-benchmark%2Fbenchmark.py;h=f43830a9c3f5b782113aadbc1718e94fc400e4d1;hb=d373c66efd68e790ef931ef19167fb24d169688b;hp=8dad78191057007cacd20c399c03123228f19f23;hpb=925d7893fbb737bc2547b3eb2d893535a713004e;p=lttng-ci.git diff --git a/scripts/babeltrace-benchmark/benchmark.py b/scripts/babeltrace-benchmark/benchmark.py index 8dad781..f43830a 100644 --- a/scripts/babeltrace-benchmark/benchmark.py +++ b/scripts/babeltrace-benchmark/benchmark.py @@ -179,6 +179,7 @@ def plot_raw_value(branch, benchmark_type, x_data, y_data, labels, latest_values ) if l_result >= ymax: ymax = 1.2 * l_result + ax = plt.gca() plt.ylim(ymin=0, ymax=ymax) plt.xticks(x_data, labels, rotation=90, family="monospace") plt.title(graph_get_title(branch, benchmark_type), fontweight="bold") @@ -186,9 +187,47 @@ def plot_raw_value(branch, benchmark_type, x_data, y_data, labels, latest_values plt.xlabel("Latest commits") plt.legend() + # Put tick on the right side + ax.tick_params(labeltop=False, labelright=True) + plt.tight_layout() return +def plot_delta_between_point(branch, benchmark_type, x_data, y_data, labels, latest_values): + """ + Plot the graph of delta between each sequential commit. + """ + local_abs_max = 100 + + # Transform y_data to a list of for which the reference is the first + # element. + local_y_data = [] + for pos, y in enumerate(y_data): + if pos == 0: + local_y_data.append(0.0) + continue + local_y_data.append(y - y_data[pos - 1]) + + plt.plot(x_data, local_y_data, "o", label=branch, color=graph_get_color(branch)) + + # Get max absolute value to align the y axis with zero in the middle. + if local_y_data: + local_abs_max = abs(max(local_y_data, key=abs)) * 1.3 + + plt.ylim(ymin=local_abs_max * -1, ymax=local_abs_max) + + ax = plt.gca() + plt.xticks(x_data, labels, rotation=90, family="monospace") + plt.title(graph_get_title(branch, benchmark_type) + " Delta to previous commit", fontweight="bold") + plt.ylabel("Seconds") + plt.xlabel("Latest commits") + plt.legend() + + # Put tick on the right side + ax.tick_params(labeltop=False, labelright=True) + + plt.tight_layout() + return def plot_ratio(branch, benchmark_type, x_data, y_data, labels, latest_values): """ @@ -243,10 +282,12 @@ def plot_ratio(branch, benchmark_type, x_data, y_data, labels, latest_values): plt.xlabel("Latest commits") plt.legend() + # Put tick on the right side + ax.tick_params(labeltop=False, labelright=True) + plt.tight_layout() return - def generate_graph(branches, report_name, git_path): # The PDF document @@ -299,17 +340,21 @@ def generate_graph(branches, report_name, git_path): plot_raw_value(branch, b_type, x_data, y_data, labels, latest_values) pdf_pages.savefig(fig) - fig = plt.figure(figsize=(width, 8.27), dpi=100) # Use the mean of each sanitize dataset here, we do not care for # variance for ratio. At least not yet. y_data = [mean(sanitize_dataset(c[1][b_type])[0]) for c in results] + fig = plt.figure(figsize=(width, 8.27), dpi=100) plot_ratio(branch, b_type, x_data, y_data, labels, latest_values) pdf_pages.savefig(fig) + fig = plt.figure(figsize=(width, 8.27), dpi=100) + plot_delta_between_point(branch, b_type, x_data, y_data, labels, latest_values) + pdf_pages.savefig(fig) + pdf_pages.close() -def launch_jobs(branches, git_path, wait_for_completion, debug): +def launch_jobs(branches, git_path, wait_for_completion, debug, force): """ Lauch jobs for all missing results. """ @@ -320,7 +365,7 @@ def launch_jobs(branches, git_path, wait_for_completion, debug): with tempfile.TemporaryDirectory() as workdir: for commit in commits: b_results = get_benchmark_results(client, commit, workdir)[0] - if b_results: + if b_results and not force: continue lava_submit.submit( commit, wait_for_completion=wait_for_completion, debug=debug @@ -341,6 +386,9 @@ def main(): parser.add_argument( "--generate-jobs", action="store_true", help="Generate and send jobs" ) + parser.add_argument( + "--force-jobs", action="store_true", help="Force the queueing of jobs to lava" + ) parser.add_argument( "--do-not-wait-on-completion", action="store_true", @@ -371,10 +419,16 @@ def main(): if args.generate_jobs: print("Launching jobs for:") + for branch, cutoff in bt_branches.items(): print("\t Branch {} with cutoff {}".format(branch, cutoff)) + launch_jobs( - bt_branches, args.repo_path, not args.do_not_wait_on_completion, args.debug + bt_branches, + args.repo_path, + not args.do_not_wait_on_completion, + args.debug, + args.force_jobs, ) if args.generate_report: