asv/www/asv.js
/* Given the settings in the sidebar, generate a list of the
           graphs we need to load. */
Given the settings in the sidebar, generate a list of the
graphs we need to load.
Given the settings in the sidebar generate a list of the graphs we need to load .
function collect_graphs(current_benchmark, state) {
            function graph_to_path(benchmark_name, state) {
                var parts = [];
                $.each(state, function(key, value) {
                    if (value !== null) {
                        parts.push(key + "-" + value);
                    } else {
                        parts.push(key);
                    }
                });
                parts.sort();
                parts.splice(0, 0, "graphs");
                parts.push(benchmark_name);
                return parts.join('/') + ".json";
            }
            function graph_label(state, differences) {
                ignore = {
                    'os': null,
                    'cpu': null,
                    'arch': null,
                    'ram': null
                };
                var parts = [];
                $.each(state, function(key, value) {
                    if (!ignore.hasOwnProperty(key) &&
                        differences.hasOwnProperty(key)) {
                        if (value) {
                            parts.push(key + "-" + value);
                        } else {
                            parts.push(key);
                        }
                    }
                });
                parts.sort();
                return parts.join('; ');
            }
            function permutations(matrix) {
                if (obj_length(matrix) == 0) {
                    return [{}];
                }
                var matrix = obj_copy(matrix);
                var key = obj_get_first_key(matrix);
                var entry = matrix[key];
                delete matrix[key];
                var results = []
                $.each(permutations(matrix), function(i, result) {
                    result = obj_copy(result);
                    if (entry.length) {
                        $.each(entry, function(i, value) {
                            result[key] = value;
                            results.push(obj_copy(result));
                        });
                    } else {
                        result[key] = null;
                        results.push(obj_copy(result));
                    }
                });
                results.sort();
                return results;
            }
            function find_different_properties(graphs) {
                var different = {};
                var last_values = obj_copy(graphs[0]);
                $.each(graphs, function(i, graph) {
                    $.each(graph, function(key, val) {
                        if (last_values[key] != val) {
                            different[key] = true;
                        }
                    });
                });
                return different;
            }
            if (current_benchmark) {
                var graphs = permutations(state);
                var different = find_different_properties(graphs);
                var all = []
                $.each(graphs, function(i, graph) {
                    all.push([graph_to_path(current_benchmark, graph),
                              graph_label(graph, different)]);
                });
                return all;
            } else {
                return [];
            }
        }
function collect_graphs ( current_benchmark , state ) { function graph_to_path ( benchmark_name , state ) { var parts = [ ] ; $ . each ( state , function ( key , value ) { if ( value !== null ) { parts . push ( key + "-" + value ) ; } else { parts . push ( key ) ; } } ) ; parts . sort ( ) ; parts . splice ( 0 , 0 , "graphs" ) ; parts . push ( benchmark_name ) ; return parts . join ( '/' ) + ".json" ; } function graph_label ( state , differences ) { ignore = { 'os' : null , 'cpu' : null , 'arch' : null , 'ram' : null } ; var parts = [ ] ; $ . each ( state , function ( key , value ) { if ( ! ignore . hasOwnProperty ( key ) && differences . hasOwnProperty ( key ) ) { if ( value ) { parts . push ( key + "-" + value ) ; } else { parts . push ( key ) ; } } } ) ; parts . sort ( ) ; return parts . join ( '; ' ) ; } function permutations ( matrix ) { if ( obj_length ( matrix ) == 0 ) { return [ { } ] ; } var matrix = obj_copy ( matrix ) ; var key = obj_get_first_key ( matrix ) ; var entry = matrix [ key ] ; delete matrix [ key ] ; var results = [ ] $ . each ( permutations ( matrix ) , function ( i , result ) { result = obj_copy ( result ) ; if ( entry . length ) { $ . each ( entry , function ( i , value ) { result [ key ] = value ; results . push ( obj_copy ( result ) ) ; } ) ; } else { result [ key ] = null ; results . push ( obj_copy ( result ) ) ; } } ) ; results . sort ( ) ; return results ; } function find_different_properties ( graphs ) { var different = { } ; var last_values = obj_copy ( graphs [ 0 ] ) ; $ . each ( graphs , function ( i , graph ) { $ . each ( graph , function ( key , val ) { if ( last_values [ key ] != val ) { different [ key ] = true ; } } ) ; } ) ; return different ; } if ( current_benchmark ) { var graphs = permutations ( state ) ; var different = find_different_properties ( graphs ) ; var all = [ ] $ . each ( graphs , function ( i , graph ) { all . push ( [ graph_to_path ( current_benchmark , graph ) , graph_label ( graph , different ) ] ) ; } ) ; return all ; } else { return [ ] ; } }
Given the settings in the sidebar, generate a list of the
graphs we need to load.
Given the settings in the sidebar generate a list of the graphs we need to load .
/* Given a specific group of parameters, generate the URL to
               use to load that graph. */ /* Given a specific group of parameters, generate the legend
               label to display for that line. Differences is an object of
               parameters that have different values across all graphs. */ /* For a given parameter matrix, generate all permutations. */ /* For all of the selected graphs, find out which parameters
               have different values across them.  We don't want to show
               parameters that are the same across all graphs in the
               legend labels, as that information is not really
               necessary. */ /* For the current set of enabled parameters, generate a
                   list of all the graphs we need to load. */ /* Find where the parameters are different. */ /* Generate a master list of URLs and legend labels for
                   the graphs. */