<commit_before>(function() { 
google.charts.load('visualization', '1.0',  {'packages':['corechart', 'controls']});
google.charts.setOnLoadCallback(drawDashboard);
var getData = function(cb) {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState == XMLHttpRequest.DONE) {
            return cb(xhr.responseText)
        }
    };
    xhr.open('GET', '/perflog', true);
    xhr.send();
    console.log("Fetching data");
}

function median(values) {
    values.sort(function(a,b){return a - b});
    var piv = Math.floor(values.length / 2);
    return values.length % 2 ? values[piv] : (values[piv] + values[piv] / 2.0);
}

function drawDashboard() {
    getData(function(data) {
        data = JSON.parse(data);
        var keys = Object.keys(data.data[0]);
        var tmp = data.data.map(function(d) {
            return keys.map(function(key) { return d[key];});
        });
        console.log("Keys", keys);
        var preppedData = [keys].concat(tmp);
        var dt = google.visualization.arrayToDataTable(preppedData);

        var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div'));
        // create the filters
        
        var sysmemFilter = new google.visualization.ControlWrapper({
            'controlType': 'NumberRangeFilter',
            'containerId': 'sysmem_filter_div',
            'options': {
                'filterColumnLabel': 'sysmem',
            },
            'state': { 'lowValue': 0, 'highValue': 32 }
        });
        
        var gpuFilter = new google.visualization.ControlWrapper({<commit_msg>Fix grouping bug in median function<commit_after>(function() { 
google.charts.load('visualization', '1.0',  {'packages':['corechart', 'controls']});
google.charts.setOnLoadCallback(drawDashboard);
var getData = function(cb) {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState == XMLHttpRequest.DONE) {
            return cb(xhr.responseText)
        }
    };
    xhr.open('GET', '/perflog', true);
    xhr.send();
    console.log("Fetching data");
}

function median(values) {
    values.sort(function(a,b){return a - b});
    var piv = Math.floor(values.length / 2);
    return values.length % 2 ? values[piv] : (values[piv] + values[piv]) / 2.0;
}

function drawDashboard() {
    getData(function(data) {
        data = JSON.parse(data);
        var keys = Object.keys(data.data[0]);
        var tmp = data.data.map(function(d) {
            return keys.map(function(key) { return d[key];});
        });
        console.log("Keys", keys);
        var preppedData = [keys].concat(tmp);
        var dt = google.visualization.arrayToDataTable(preppedData);

        var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div'));
        // create the filters
        
        var sysmemFilter = new google.visualization.ControlWrapper({
            'controlType': 'NumberRangeFilter',
            'containerId': 'sysmem_filter_div',
            'options': {
                'filterColumnLabel': 'sysmem',
            },
            'state': { 'lowValue': 0, 'highValue': 32 }
        });
        
        var gpuFilter = new google.visualization.ControlWrapper({
{'fraction_non_alphanumeric': 0.1491442542787286, 'fraction_numerical': 0.006112469437652812, 'mean_word_length': 2.6447661469933186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5675372', 'n_tokens_mistral': 1011, 'n_tokens_neox': 985, 'n_words': 188}