'use strict'; $(document).ready(function() { /* The state of the parameters in the sidebar. Dictionary mapping strings to arrays containing the "enabled" configurations. */ var state = null; /* The name of the current benchmark being displayed. */ var current_benchmark = null; /* An array of graphs being displayed. */ var graphs = []; var orig_graphs = []; /* An array of commit revisions being displayed */ var current_revisions = []; /* True when log scaling is enabled. */ var log_scale = false; /* True when zooming in on the y-axis. */ var zoom_y_axis = false; /* True when log scaling is enabled. */ var reference_scale = false; /* True when selecting a reference point */ var select_reference = false; /* The reference value */ var reference = 1.0; /* Whether to show the legend */ var show_legend = true; /* Is even commit spacing being used? */ var even_spacing = false; var even_spacing_revisions = []; /* Is date scale being used ? */ var date_scale = false; var date_to_revision = {}; /* A little div to handle tooltip placement on the graph */ var tooltip = null; /* X-axis coordinate axis in the data set; always 0 for non-parameterized tests where revision and date are the only potential x-axis */ var x_coordinate_axis = 0; var x_coordinate_is_category = false; /* List of lists of value combinations to plot (apart from x-axis) in parameterized tests. */ var benchmark_param_selection = [[null]]; /* Highlighted revisions */ var highlighted_revisions = null; /* Whether benchmark graph display was set up */ var benchmark_graph_display_ready = false; /* UTILITY FUNCTIONS */ function arr_remove_from(a, x) { var out = []; $.each(a, function(i, val) { if (x !== val) { out.push(val); } }); return out; } function obj_copy(obj) { var newobj = {}; $.each(obj, function(key, val) { newobj[key] = val; }); return newobj; } function obj_length(obj) { var i = 0; for (var x in obj) ++i; return i; } function obj_get_first_key(data) { for (var prop in data) return prop; } function no_data(ajax, status, error) { $("#error-message").text( "No data for this combination of filters. "); $("#error").modal('show'); } function get_x_from_revision(rev) { if (date_scale) { return $.asv.main_json.revision_to_date[rev]; } else { return rev; } } function get_commit_hash(x) { // Return the commit hash in the current graph located at position x if (date_scale) { x = date_to_revision[x]; } return $.asv.get_commit_hash(x); } function display_benchmark(bm_name, state_selection, highlight_revisions) { setup_benchmark_graph_display(); $('#graph-display').show(); $('#summarygrid-display').hide(); $('#regressions-display').hide(); $('.tooltip').remove(); if (reference_scale) { reference_scale = false; $('#reference').removeClass('active'); reference = 1.0; } current_benchmark = bm_name; highlighted_revisions = highlight_revisions; $("#title").text(bm_name); setup_benchmark_params(state_selection); replace_graphs(); } function setup_benchmark_graph_display() { if (benchmark_graph_display_ready) { return; } benchmark_graph_display_ready = true; /* When the window resizes, redraw the graphs */ $(window).on('resize', function() { update_graphs(); }); var nav = $("#graphdisplay-navigation"); /* Make the static tooltips look correct */ $('[data-toggle="tooltip"]').tooltip({container: 'body'}); /* Add insertion point for benchmark parameters */ var state_params_nav = $("
"); nav.append(state_params_nav); /* Add insertion point for benchmark parameters */ var bench_params_nav = $("
"); nav.append(bench_params_nav); /* Benchmark panel */ var panel_body = $.asv.ui.make_panel(nav, 'benchmark'); var tree = $('