def histogram_plot(experiment_log_dir, plot_spec_string, output_filename, has_legend, x_limit, verbose): queries = [ plot_utils.plot_spec_string_to_query(plot_spec_string, 0, "HIST")] plot_data = metaprogram_utils.process_queries( queries, experiment_log_dir, verbose) if "plot_points" not in plot_data: warnings.warn("No data to plot!") return histogram_data = plot_data["plot_points"][0] cumulative_histogram = {} layout = PlotLayout() layout.dpi = 250 for stat_name in histogram_data: plot = Plot() plot.setTitle(stat_name) if has_legend: plot.hasLegend(labelSize=8) if x_limit is not None: plot.setXLimits(0, x_limit) style_plot(plot, stat_name) for key, points in sorted(histogram_data[stat_name].items()): for size, count in itertools.izip(points["bin"], points["count"]): if size not in cumulative_histogram: cumulative_histogram[size] = 0 cumulative_histogram[size] += count line = Line() line.stepFunction("pre") line.label = str(key) line.xValues = points["bin"] line.yValues = points["count"] plot.add(line) layout.addPlot(plot) cumulative_plot = Plot() if x_limit is not None: cumulative_plot.setXLimits(0, x_limit) cumulative_plot.setTitle("Cumulative Histogram for " + stat_name) style_plot(cumulative_plot, stat_name) line = Line() line.stepFunction("pre") line.xValues = sorted(cumulative_histogram.keys()) line.yValues = [cumulative_histogram[key] for key in line.xValues] cumulative_plot.add(line) layout.addPlot(cumulative_plot) layout.save(output_filename)
def time_series_plot(experiment_log_dir, plot_spec_strings, make_legend, split_by_host, group_by_query, verbose): queries = [] for i, plot_spec_string in enumerate(plot_spec_strings): queries.append( plot_utils.plot_spec_string_to_query(plot_spec_string, i, "COLL")) plot_data = metaprogram_utils.process_queries(queries, experiment_log_dir, verbose) plots = make_plots(plot_data, make_legend, split_by_host, group_by_query) if len(plots) == 0: warnings.warn("No data to plot!") return return plots
def time_series_plot(experiment_log_dir, plot_spec_strings, make_legend, split_by_host, group_by_query, verbose): queries = [] for i, plot_spec_string in enumerate(plot_spec_strings): queries.append( plot_utils.plot_spec_string_to_query( plot_spec_string, i, "COLL")) plot_data = metaprogram_utils.process_queries( queries, experiment_log_dir, verbose) plots = make_plots(plot_data, make_legend, split_by_host, group_by_query) if len(plots) == 0: warnings.warn("No data to plot!") return return plots
def histogram_plot(experiment_log_dir, plot_spec_string, output_filename, has_legend, x_limit, verbose): queries = [ plot_utils.plot_spec_string_to_query(plot_spec_string, 0, "HIST") ] plot_data = metaprogram_utils.process_queries(queries, experiment_log_dir, verbose) if "plot_points" not in plot_data: warnings.warn("No data to plot!") return histogram_data = plot_data["plot_points"][0] cumulative_histogram = {} layout = PlotLayout() layout.dpi = 250 for stat_name in histogram_data: plot = Plot() plot.setTitle(stat_name) if has_legend: plot.hasLegend(labelSize=8) if x_limit is not None: plot.setXLimits(0, x_limit) style_plot(plot, stat_name) for key, points in sorted(histogram_data[stat_name].items()): for size, count in itertools.izip(points["bin"], points["count"]): if size not in cumulative_histogram: cumulative_histogram[size] = 0 cumulative_histogram[size] += count line = Line() line.stepFunction("pre") line.label = str(key) line.xValues = points["bin"] line.yValues = points["count"] plot.add(line) layout.addPlot(plot) cumulative_plot = Plot() if x_limit is not None: cumulative_plot.setXLimits(0, x_limit) cumulative_plot.setTitle("Cumulative Histogram for " + stat_name) style_plot(cumulative_plot, stat_name) line = Line() line.stepFunction("pre") line.xValues = sorted(cumulative_histogram.keys()) line.yValues = [cumulative_histogram[key] for key in line.xValues] cumulative_plot.add(line) layout.addPlot(cumulative_plot) layout.save(output_filename)