Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Telemetry Performance Test Results</title> | 4 <title>Telemetry Performance Test Results</title> |
| 5 <style type="text/css"> | 5 <style type="text/css"> |
| 6 | 6 |
| 7 section { | 7 section { |
| 8 background: white; | 8 background: white; |
| 9 padding: 10px; | 9 padding: 10px; |
| 10 position: relative; | 10 position: relative; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 } | 242 } |
| 243 | 243 |
| 244 .closeAllButton:hover { | 244 .closeAllButton:hover { |
| 245 background: #f04040; | 245 background: #f04040; |
| 246 } | 246 } |
| 247 | 247 |
| 248 </style> | 248 </style> |
| 249 </head> | 249 </head> |
| 250 <body onload="init()"> | 250 <body onload="init()"> |
| 251 <div style="padding: 0 10px; white-space: nowrap;"> | 251 <div style="padding: 0 10px; white-space: nowrap;"> |
| 252 Result <span id="time-memory" class="checkbox"><span class="checked">Time</span> <span>Memory</span></span> | 252 Result <span id="time-memory" class="checkbox"></span> |
| 253 Reference <span id="reference" class="checkbox"></span> | 253 Reference <span id="reference" class="checkbox"></span> |
| 254 Style <span id="scatter-line" class="checkbox"><span class="checked">Scatter</sp an><span>Line</span></span> | 254 Style <span id="scatter-line" class="checkbox"><span class="checked">Scatter</sp an><span>Line</span></span> |
| 255 <span class="checkbox"><span class="checked" id="undelete">Undelete</span></span ><br> | 255 <span class="checkbox"><span class="checked" id="undelete">Undelete</span></span ><br> |
| 256 Run your test with --reset-results to clear all runs | 256 Run your test with --reset-results to clear all runs |
| 257 </div> | 257 </div> |
| 258 <table id="container"></table> | 258 <table id="container"></table> |
| 259 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js">< /script> | 259 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js">< /script> |
| 260 <script> | 260 <script> |
| 261 %plugins% | 261 %plugins% |
| 262 </script> | 262 </script> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 catch (e) { | 309 catch (e) { |
| 310 console.error(e, e.stack); | 310 console.error(e, e.stack); |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 } else { | 313 } else { |
| 314 values = []; | 314 values = []; |
| 315 } | 315 } |
| 316 | 316 |
| 317 this.test = function () { return metric; } | 317 this.test = function() { return metric; } |
| 318 this.values = function () { return values.map(function (value) { return metr ic.scalingFactor() * value; }); } | 318 this.values = function() { return values.map(function(value) { return metric .scalingFactor() * value; }); } |
| 319 this.unscaledMean = function () { return Statistics.sum(values) / values.len gth; } | 319 this.unscaledMean = function() { return Statistics.sum(values) / values.leng th; } |
| 320 this.mean = function () { return metric.scalingFactor() * this.unscaledMean( ); } | 320 this.mean = function() { return metric.scalingFactor() * this.unscaledMean() ; } |
| 321 this.min = function () { return metric.scalingFactor() * Statistics.min(valu es); } | 321 this.min = function() { return metric.scalingFactor() * Statistics.min(value s); } |
| 322 this.max = function () { return metric.scalingFactor() * Statistics.max(valu es); } | 322 this.max = function() { return metric.scalingFactor() * Statistics.max(value s); } |
| 323 this.confidenceIntervalDelta = function () { | 323 this.confidenceIntervalDelta = function() { |
| 324 if (std !== undefined) { | 324 if (std !== undefined) { |
| 325 return metric.scalingFactor() * Statistics.confidenceIntervalDeltaFr omStd(0.95, values.length, | 325 return metric.scalingFactor() * Statistics.confidenceIntervalDeltaFr omStd(0.95, values.length, |
| 326 std, degreesOfFreedom); | 326 std, degreesOfFreedom); |
| 327 } | 327 } |
| 328 return metric.scalingFactor() * Statistics.confidenceIntervalDelta(0.95, values.length, | 328 return metric.scalingFactor() * Statistics.confidenceIntervalDelta(0.95, values.length, |
| 329 Statistics.sum(values), Statistics.squareSum(values)); | 329 Statistics.sum(values), Statistics.squareSum(values)); |
| 330 } | 330 } |
| 331 this.confidenceIntervalDeltaRatio = function () { return this.confidenceInte rvalDelta() / this.mean(); } | 331 this.confidenceIntervalDeltaRatio = function() { return this.confidenceInter valDelta() / this.mean(); } |
| 332 this.percentDifference = function(other) { | 332 this.percentDifference = function(other) { |
| 333 if (other === undefined) { | 333 if (other === undefined) { |
| 334 return undefined; | 334 return undefined; |
| 335 } | 335 } |
| 336 return (other.unscaledMean() - this.unscaledMean()) / this.unscaledMean( ); | 336 return (other.unscaledMean() - this.unscaledMean()) / this.unscaledMean( ); |
| 337 } | 337 } |
| 338 this.isStatisticallySignificant = function (other) { | 338 this.isStatisticallySignificant = function(other) { |
| 339 if (other === undefined) { | 339 if (other === undefined) { |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 var diff = Math.abs(other.mean() - this.mean()); | 342 var diff = Math.abs(other.mean() - this.mean()); |
| 343 return diff > this.confidenceIntervalDelta() && diff > other.confidenceI ntervalDelta(); | 343 return diff > this.confidenceIntervalDelta() && diff > other.confidenceI ntervalDelta(); |
| 344 } | 344 } |
| 345 this.run = function () { return associatedRun; } | 345 this.run = function() { return associatedRun; } |
| 346 } | 346 } |
| 347 | 347 |
| 348 function TestRun(entry) { | 348 function TestRun(entry) { |
| 349 this.id = function() { return entry['buildTime'].replace(/[:.-]/g,''); } | 349 this.id = function() { return entry['buildTime'].replace(/[:.-]/g,''); } |
| 350 this.label = function () { | 350 this.label = function() { |
| 351 if (labelKey in localStorage) | 351 if (labelKey in localStorage) |
| 352 return localStorage[labelKey]; | 352 return localStorage[labelKey]; |
| 353 return entry['label']; | 353 return entry['label']; |
| 354 } | 354 } |
| 355 this.setLabel = function(label) { localStorage[labelKey] = label; } | 355 this.setLabel = function(label) { localStorage[labelKey] = label; } |
| 356 this.isHidden = function() { return localStorage[hiddenKey]; } | 356 this.isHidden = function() { return localStorage[hiddenKey]; } |
| 357 this.hide = function() { localStorage[hiddenKey] = true; } | 357 this.hide = function() { localStorage[hiddenKey] = true; } |
| 358 this.show = function() { localStorage.removeItem(hiddenKey); } | 358 this.show = function() { localStorage.removeItem(hiddenKey); } |
| 359 this.description = function() { | 359 this.description = function() { |
| 360 return new Date(entry['buildTime']).toLocaleString() + '\n' + entry['pla tform'] + ' ' + this.label(); | 360 return new Date(entry['buildTime']).toLocaleString() + '\n' + entry['pla tform'] + ' ' + this.label(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 383 cachedUnit = 'M ' + unit; | 383 cachedUnit = 'M ' + unit; |
| 384 } else if (mean > 10 * kilo) { | 384 } else if (mean > 10 * kilo) { |
| 385 cachedScalingFactor = 1 / kilo; | 385 cachedScalingFactor = 1 / kilo; |
| 386 cachedUnit = unit == 'ms' ? 's' : ('K ' + unit); | 386 cachedUnit = unit == 'ms' ? 's' : ('K ' + unit); |
| 387 } else { | 387 } else { |
| 388 cachedScalingFactor = 1; | 388 cachedScalingFactor = 1; |
| 389 cachedUnit = unit; | 389 cachedUnit = unit; |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 this.name = function () { return name + ':' + metric; } | 393 this.name = function() { return name + ':' + metric; } |
| 394 this.isImportant = isImportant; | 394 this.isImportant = isImportant; |
| 395 this.isMemoryTest = function () { | 395 this.isMemoryTest = function() { |
| 396 return (unit == 'kb' || | 396 return (unit == 'kb' || |
| 397 unit == 'KB' || | 397 unit == 'KB' || |
| 398 unit == 'MB' || | 398 unit == 'MB' || |
| 399 unit == 'bytes' || | 399 unit == 'bytes' || |
| 400 unit == 'count' || | 400 unit == 'count' || |
| 401 !metric.indexOf('V8.')); | 401 !metric.indexOf('V8.')); |
| 402 } | 402 } |
| 403 this.addResult = function (newResult) { | 403 this.addResult = function(newResult) { |
| 404 testResults.push(newResult); | 404 testResults.push(newResult); |
| 405 cachedUnit = null; | 405 cachedUnit = null; |
| 406 cachedScalingFactor = null; | 406 cachedScalingFactor = null; |
| 407 } | 407 } |
| 408 this.results = function () { return testResults; } | 408 this.results = function() { return testResults; } |
| 409 this.scalingFactor = function() { | 409 this.scalingFactor = function() { |
| 410 computeScalingFactorIfNeeded(); | 410 computeScalingFactorIfNeeded(); |
| 411 return cachedScalingFactor; | 411 return cachedScalingFactor; |
| 412 } | 412 } |
| 413 this.unit = function () { | 413 this.unit = function() { |
| 414 computeScalingFactorIfNeeded(); | 414 computeScalingFactorIfNeeded(); |
| 415 return cachedUnit; | 415 return cachedUnit; |
| 416 } | 416 } |
| 417 this.biggerIsBetter = function () { | 417 this.biggerIsBetter = function() { |
| 418 if (window.unitToBiggerIsBetter == undefined) { | 418 if (window.unitToBiggerIsBetter == undefined) { |
| 419 window.unitToBiggerIsBetter = {}; | 419 window.unitToBiggerIsBetter = {}; |
| 420 var units = JSON.parse(document.getElementById('units-json').textCon tent); | 420 var units = JSON.parse(document.getElementById('units-json').textCon tent); |
| 421 for (var u in units) { | 421 for (var u in units) { |
| 422 if (units[u].improvement_direction == 'up') { | 422 if (units[u].improvement_direction == 'up') { |
| 423 window.unitToBiggerIsBetter[u] = true; | 423 window.unitToBiggerIsBetter[u] = true; |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 return window.unitToBiggerIsBetter[unit]; | 427 return window.unitToBiggerIsBetter[unit]; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 section.children('.plot').css({'width': (100 * test.results().length + 2 5) + 'px', 'height': '300px'}); | 524 section.children('.plot').css({'width': (100 * test.results().length + 2 5) + 'px', 'height': '300px'}); |
| 525 $(container).append(section); | 525 $(container).append(section); |
| 526 | 526 |
| 527 var plotContainer = section.children('.plot'); | 527 var plotContainer = section.children('.plot'); |
| 528 var minIsZero = true; | 528 var minIsZero = true; |
| 529 attachPlot(test, plotContainer, minIsZero); | 529 attachPlot(test, plotContainer, minIsZero); |
| 530 | 530 |
| 531 attachLinePlots(test, section.children('.line-plots'), useLargeLinePlots ); | 531 attachLinePlots(test, section.children('.line-plots'), useLargeLinePlots ); |
| 532 | 532 |
| 533 var tooltip = section.children('.tooltip'); | 533 var tooltip = section.children('.tooltip'); |
| 534 plotContainer.bind('plothover', function (event, position, item) { | 534 plotContainer.bind('plothover', function(event, position, item) { |
| 535 if (item) { | 535 if (item) { |
| 536 var postfix = item.series.id ? ' (' + item.series.id + ')' : ''; | 536 var postfix = item.series.id ? ' (' + item.series.id + ')' : ''; |
| 537 tooltip.html(item.datapoint[1].toPrecision(4) + postfix); | 537 tooltip.html(item.datapoint[1].toPrecision(4) + postfix); |
| 538 var sectionOffset = $(section).offset(); | 538 var sectionOffset = $(section).offset(); |
| 539 tooltip.css({left: item.pageX - sectionOffset.left - tooltip.out erWidth() / 2, top: item.pageY - sectionOffset.top + 10}); | 539 tooltip.css({left: item.pageX - sectionOffset.left - tooltip.out erWidth() / 2, top: item.pageY - sectionOffset.top + 10}); |
| 540 tooltip.fadeIn(200); | 540 tooltip.fadeIn(200); |
| 541 } else | 541 } else |
| 542 tooltip.hide(); | 542 tooltip.hide(); |
| 543 }); | 543 }); |
| 544 plotContainer.mouseout(function () { | 544 plotContainer.mouseout(function() { |
| 545 tooltip.hide(); | 545 tooltip.hide(); |
| 546 }); | 546 }); |
| 547 plotContainer.click(function (event) { | 547 plotContainer.click(function(event) { |
| 548 event.preventDefault(); | 548 event.preventDefault(); |
| 549 minIsZero = !minIsZero; | 549 minIsZero = !minIsZero; |
| 550 attachPlot(test, plotContainer, minIsZero); | 550 attachPlot(test, plotContainer, minIsZero); |
| 551 }); | 551 }); |
| 552 } | 552 } |
| 553 return section; | 553 return section; |
| 554 } | 554 } |
| 555 | 555 |
| 556 function attachLinePlots(test, container, useLargeLinePlots) { | 556 function attachLinePlots(test, container, useLargeLinePlots) { |
| 557 var results = test.results(); | 557 var results = test.results(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 580 var options = $.extend(true, {}, largeLinePlotOptions, | 580 var options = $.extend(true, {}, largeLinePlotOptions, |
| 581 {yaxis: {min: 0.0, max: maximum}, | 581 {yaxis: {min: 0.0, max: maximum}, |
| 582 xaxis: {min: 0.0, max: values.length - 1}, | 582 xaxis: {min: 0.0, max: values.length - 1}, |
| 583 points: {show: (values.length < 2) ? true : fals e}}); | 583 points: {show: (values.length < 2) ? true : fals e}}); |
| 584 } else { | 584 } else { |
| 585 var options = $.extend(true, {}, linePlotOptions, | 585 var options = $.extend(true, {}, linePlotOptions, |
| 586 {yaxis: {min: Math.min.apply(Math, values) * 0.9, max: Math.max.apply(Math, values) * 1.1}, | 586 {yaxis: {min: Math.min.apply(Math, values) * 0.9, max: Math.max.apply(Math, values) * 1.1}, |
| 587 xaxis: {min: -0.5, max: values.length - 0.5}, | 587 xaxis: {min: -0.5, max: values.length - 0.5}, |
| 588 points: {show: (values.length < 2) ? true : fals e}}); | 588 points: {show: (values.length < 2) ? true : fals e}}); |
| 589 } | 589 } |
| 590 $.plot(container.children().last(), [values.map(function (value, index) { return [index, value]; })], options); | 590 $.plot(container.children().last(), [values.map(function(value, index) { return [index, value]; })], options); |
| 591 } | 591 } |
| 592 if (!attachedPlot) | 592 if (!attachedPlot) |
| 593 container.children().remove(); | 593 container.children().remove(); |
| 594 } | 594 } |
| 595 | 595 |
| 596 function attachHistogramPlots(test, container) { | 596 function attachHistogramPlots(test, container) { |
| 597 var results = test.results(); | 597 var results = test.results(); |
| 598 var attachedPlot = false; | 598 var attachedPlot = false; |
| 599 | 599 |
| 600 for (var i = 0; i < results.length; i++) { | 600 for (var i = 0; i < results.length; i++) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 var results = test.results(); | 640 var results = test.results(); |
| 641 var attachedPlot = false; | 641 var attachedPlot = false; |
| 642 for (var i = 0; i < results.length; i++) { | 642 for (var i = 0; i < results.length; i++) { |
| 643 container.append('<div>' + results[i].run().label() + '</div>'); | 643 container.append('<div>' + results[i].run().label() + '</div>'); |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 function attachPlot(test, plotContainer, minIsZero) { | 647 function attachPlot(test, plotContainer, minIsZero) { |
| 648 var results = test.results(); | 648 var results = test.results(); |
| 649 | 649 |
| 650 var values = results.reduce(function (values, result, index) { | 650 var values = results.reduce(function(values, result, index) { |
| 651 var newValues = result.values(); | 651 var newValues = result.values(); |
| 652 return newValues ? values.concat(newValues.map(function (value) { return [index, value]; })) : values; | 652 return newValues ? values.concat(newValues.map(function(value) { return [index, value]; })) : values; |
| 653 }, []); | 653 }, []); |
| 654 | 654 |
| 655 var plotData = [$.extend(true, {}, subpointsPlotOptions, {data: values})]; | 655 var plotData = [$.extend(true, {}, subpointsPlotOptions, {data: values})]; |
| 656 plotData.push({id: 'μ', data: results.map(function (result, index) { retu rn [index, result.mean()]; }), color: plotColor}); | 656 plotData.push({id: 'μ', data: results.map(function(result, index) { retur n [index, result.mean()]; }), color: plotColor}); |
| 657 | 657 |
| 658 var overallMax = Statistics.max(results.map(function (result, index) { retur n result.max(); })); | 658 var overallMax = Statistics.max(results.map(function(result, index) { return result.max(); })); |
| 659 var overallMin = Statistics.min(results.map(function (result, index) { retur n result.min(); })); | 659 var overallMin = Statistics.min(results.map(function(result, index) { return result.min(); })); |
| 660 var margin = (overallMax - overallMin) * 0.1; | 660 var margin = (overallMax - overallMin) * 0.1; |
| 661 var currentPlotOptions = $.extend(true, {}, mainPlotOptions, {yaxis: { | 661 var currentPlotOptions = $.extend(true, {}, mainPlotOptions, {yaxis: { |
| 662 min: minIsZero ? 0 : overallMin - margin, | 662 min: minIsZero ? 0 : overallMin - margin, |
| 663 max: minIsZero ? overallMax * 1.1 : overallMax + margin}}); | 663 max: minIsZero ? overallMax * 1.1 : overallMax + margin}}); |
| 664 | 664 |
| 665 currentPlotOptions.xaxis.max = results.length - 0.5; | 665 currentPlotOptions.xaxis.max = results.length - 0.5; |
| 666 currentPlotOptions.xaxis.ticks = results.map(function (result, index) { retu rn [index, result.run().label()]; }); | 666 currentPlotOptions.xaxis.ticks = results.map(function(result, index) { retur n [index, result.run().label()]; }); |
| 667 | 667 |
| 668 $.plot(plotContainer, plotData, currentPlotOptions); | 668 $.plot(plotContainer, plotData, currentPlotOptions); |
| 669 } | 669 } |
| 670 | 670 |
| 671 function toFixedWidthPrecision(value) { | 671 function toFixedWidthPrecision(value) { |
| 672 var decimal = value.toFixed(2); | 672 var decimal = value.toFixed(2); |
| 673 return decimal; | 673 return decimal; |
| 674 } | 674 } |
| 675 | 675 |
| 676 function formatPercentage(fraction) { | 676 function formatPercentage(fraction) { |
| 677 var percentage = fraction * 100; | 677 var percentage = fraction * 100; |
| 678 return (fraction * 100).toFixed(2) + '%'; | 678 return (fraction * 100).toFixed(2) + '%'; |
| 679 } | 679 } |
| 680 | 680 |
| 681 function setUpSortClicks(runs) | 681 function setUpSortClicks(runs) |
| 682 { | 682 { |
| 683 $('#nameColumn').click(sortByName); | 683 $('#nameColumn').click(sortByName); |
| 684 | 684 |
| 685 $('#unitColumn').click(sortByUnit); | 685 $('#unitColumn').click(sortByUnit); |
| 686 | 686 |
| 687 runs.forEach(function(run) { | 687 runs.forEach(function(run) { |
| 688 $('#' + run.id()).click(sortByResult); | 688 $('#' + run.id()).click(sortByResult); |
| 689 $('#' + run.id() + COMPARISON_SUFFIX).click(sortByReference); | 689 $('#' + run.id() + COMPARISON_SUFFIX).click(sortByReference); |
| 690 }); | 690 }); |
| 691 } | 691 } |
| 692 | 692 |
| 693 function TestTypeSelector(tests) { | |
| 694 this.recognizers = { | |
| 695 'Time': function(test) { return test.isMemoryTest(); }, | |
| 696 'Memory': function(test) { return !test.isMemoryTest(); } | |
| 697 }; | |
| 698 this.testTypeNames = this.generateUsedTestTypeNames(tests); | |
| 699 // Default to selecting the first test-type name in the list. | |
| 700 this.testTypeName = this.testTypeNames[0]; | |
| 701 } | |
| 702 | |
| 703 TestTypeSelector.prototype = { | |
| 704 set testTypeName(testTypeName) { | |
| 705 this._testTypeName = testTypeName; | |
| 706 this.shouldShowTest = this.recognizers[testTypeName]; | |
| 707 }, | |
| 708 | |
| 709 generateUsedTestTypeNames: function(allTests) { | |
| 710 var testTypeNames = []; | |
| 711 | |
| 712 for (var recognisedTestName in this.recognizers) { | |
|
petrcermak
2016/01/04 10:44:04
nit: s/recognised/recognized/ for consistency
picksi
2016/01/05 13:30:46
Done.
| |
| 713 var recognizes = this.recognizers[recognisedTestName]; | |
|
petrcermak
2016/01/04 10:44:05
nit: I'd say 'var recognizer', but feel free to ig
picksi
2016/01/05 13:30:46
I've left it as recognizes to keep the "if (recogn
| |
| 714 for (var testName in allTests) { | |
| 715 var test = allTests[testName]; | |
| 716 if (recognizes(test)) { | |
| 717 testTypeNames.push(recognisedTestName); | |
| 718 break; | |
| 719 } | |
| 720 } | |
| 721 } | |
| 722 | |
| 723 if (testTypeNames.length === 0) { | |
| 724 // No test types we recognize, add 'No Results' with a dummy recogni zer. | |
| 725 var noResults = 'No Results'; | |
| 726 this.recognizers[noResults] = function(){ return false; }; | |
|
petrcermak
2016/01/04 10:44:04
nit: There should be a space between "()" and "{".
picksi
2016/01/05 13:30:46
Done.
| |
| 727 testTypeNames.push(noResults); | |
| 728 } else if (testTypeNames.length > 1) { | |
| 729 // We have more than one test type, so add 'All' with a recognizer t hat always succeeds. | |
| 730 var allResults = 'All'; | |
| 731 this.recognizers[allResults] = function(){ return true; }; | |
|
petrcermak
2016/01/04 10:44:04
ditto nit
picksi
2016/01/05 13:30:46
Done.
| |
| 732 testTypeNames.push(allResults); | |
| 733 } | |
| 734 | |
| 735 return testTypeNames; | |
| 736 }, | |
| 737 | |
| 738 buildButtonHTMLForUsedTestTypes: function() { | |
| 739 var selectedTestTypeName = this._testTypeName; | |
| 740 // Build spans for all recognised test names with the selected test high lighted. | |
| 741 return this.testTypeNames.map(function(testTypeName) { | |
| 742 var classAttribute = testTypeName === selectedTestTypeName ? ' class =checked': ''; | |
|
petrcermak
2016/01/04 10:44:05
nit: missing space before ':'.
picksi
2016/01/05 13:30:46
Done.
| |
| 743 return '<span' + classAttribute + '>' + testTypeName + '</span>'; | |
| 744 }).join(''); | |
| 745 } | |
| 746 | |
|
petrcermak
2016/01/04 10:44:04
nit: no need for a blank line here (it's customary
picksi
2016/01/05 13:30:46
Done.
| |
| 747 }; | |
| 748 | |
| 693 var topLevelRows; | 749 var topLevelRows; |
| 694 var allTableRows; | 750 var allTableRows; |
| 695 | 751 |
| 696 function createTable(tests, runs, shouldIgnoreMemory, referenceIndex, useLargeLi nePlots) { | 752 function displayTable(tests, runs, testTypeSelector, referenceIndex, useLargeLin ePlots) { |
| 697 var resultHeaders = runs.map(function (run, index) { | 753 var resultHeaders = runs.map(function(run, index) { |
| 698 var header = '<th id="' + run.id() + '" ' + | 754 var header = '<th id="' + run.id() + '" ' + |
| 699 'colspan=2 ' + | 755 'colspan=2 ' + |
| 700 'title="' + run.description() + '">' + | 756 'title="' + run.description() + '">' + |
| 701 '<span class="label" ' + | 757 '<span class="label" ' + |
| 702 'title="Edit run label">' + | 758 'title="Edit run label">' + |
| 703 run.label() + | 759 run.label() + |
| 704 '</span>' + | 760 '</span>' + |
| 705 '<div class="closeButton" ' + | 761 '<div class="closeButton" ' + |
| 706 'title="Delete run">' + | 762 'title="Delete run">' + |
| 707 '×' + | 763 '×' + |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 798 |
| 743 $('#container').html(htmlString); | 799 $('#container').html(htmlString); |
| 744 | 800 |
| 745 var testNames = []; | 801 var testNames = []; |
| 746 for (testName in tests) | 802 for (testName in tests) |
| 747 testNames.push(testName); | 803 testNames.push(testName); |
| 748 | 804 |
| 749 allTableRows = []; | 805 allTableRows = []; |
| 750 testNames.forEach(function(testName) { | 806 testNames.forEach(function(testName) { |
| 751 var test = tests[testName]; | 807 var test = tests[testName]; |
| 752 if (test.isMemoryTest() === shouldIgnoreMemory) { | 808 if (testTypeSelector.shouldShowTest(test)) { |
| 753 return; | 809 allTableRows.push(new TableRow(runs, test, referenceIndex, useLargeL inePlots)); |
| 754 } | 810 } |
| 755 allTableRows.push(new TableRow(runs, test, referenceIndex, useLargeLineP lots)); | |
| 756 }); | 811 }); |
| 757 | 812 |
| 758 // Build a list of top level rows with attached children | 813 // Build a list of top level rows with attached children |
| 759 topLevelRows = []; | 814 topLevelRows = []; |
| 760 allTableRows.forEach(function(row) { | 815 allTableRows.forEach(function(row) { |
| 761 // Add us to top level if we are a top-level row... | 816 // Add us to top level if we are a top-level row... |
| 762 if (row.hasNoURL) { | 817 if (row.hasNoURL) { |
| 763 topLevelRows.push(row); | 818 topLevelRows.push(row); |
| 764 // Add a duplicate child row that holds the graph for the parent | 819 // Add a duplicate child row that holds the graph for the parent |
| 765 var graphHolder = new TableRow(runs, row.test, referenceIndex, useLa rgeLinePlots); | 820 var graphHolder = new TableRow(runs, row.test, referenceIndex, useLa rgeLinePlots); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 $('#labelEditor').focusout(function() { | 876 $('#labelEditor').focusout(function() { |
| 822 runs[i].setLabel(this.value); | 877 runs[i].setLabel(this.value); |
| 823 location.reload(); | 878 location.reload(); |
| 824 }); | 879 }); |
| 825 $('#labelEditor').keypress(function(event) { | 880 $('#labelEditor').keypress(function(event) { |
| 826 if (event.which == 13) { | 881 if (event.which == 13) { |
| 827 runs[i].setLabel(this.value); | 882 runs[i].setLabel(this.value); |
| 828 location.reload(); | 883 location.reload(); |
| 829 } | 884 } |
| 830 }); | 885 }); |
| 831 $('#labelEditor').click(function (event) { | 886 $('#labelEditor').click(function(event) { |
| 832 event.stopPropagation(); | 887 event.stopPropagation(); |
| 833 }); | 888 }); |
| 834 $('#labelEditor').mousedown(function (event) { | 889 $('#labelEditor').mousedown(function(event) { |
| 835 event.stopPropagation(); | 890 event.stopPropagation(); |
| 836 }); | 891 }); |
| 837 $('#labelEditor').select(); | 892 $('#labelEditor').select(); |
| 838 break; | 893 break; |
| 839 } | 894 } |
| 840 } | 895 } |
| 841 event.stopPropagation(); | 896 event.stopPropagation(); |
| 842 }); | 897 }); |
| 843 } | 898 } |
| 844 | 899 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1336 } else { | 1391 } else { |
| 1337 this.openRow(); | 1392 this.openRow(); |
| 1338 } | 1393 } |
| 1339 return false; | 1394 return false; |
| 1340 } | 1395 } |
| 1341 | 1396 |
| 1342 function init() { | 1397 function init() { |
| 1343 var runs = []; | 1398 var runs = []; |
| 1344 var metrics = {}; | 1399 var metrics = {}; |
| 1345 var deletedRunsById = {}; | 1400 var deletedRunsById = {}; |
| 1346 $.each(JSON.parse(document.getElementById('results-json').textContent), func tion (index, entry) { | 1401 $.each(JSON.parse(document.getElementById('results-json').textContent), func tion(index, entry) { |
| 1347 var run = new TestRun(entry); | 1402 var run = new TestRun(entry); |
| 1348 if (run.isHidden()) { | 1403 if (run.isHidden()) { |
| 1349 deletedRunsById[run.id()] = run; | 1404 deletedRunsById[run.id()] = run; |
| 1350 return; | 1405 return; |
| 1351 } | 1406 } |
| 1352 | 1407 |
| 1353 runs.push(run); | 1408 runs.push(run); |
| 1354 | 1409 |
| 1355 function addTests(tests) { | 1410 function addTests(tests) { |
| 1356 for (var testName in tests) { | 1411 for (var testName in tests) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1368 new TestResult(metric, rawMetrics[metricName].current, | 1423 new TestResult(metric, rawMetrics[metricName].current, |
| 1369 run, rawMetrics[metricName]['std'], rawMetrics[metri cName]['degrees_of_freedom'])); | 1424 run, rawMetrics[metricName]['std'], rawMetrics[metri cName]['degrees_of_freedom'])); |
| 1370 } | 1425 } |
| 1371 } | 1426 } |
| 1372 } | 1427 } |
| 1373 | 1428 |
| 1374 addTests(entry.tests); | 1429 addTests(entry.tests); |
| 1375 }); | 1430 }); |
| 1376 | 1431 |
| 1377 var useLargeLinePlots = false; | 1432 var useLargeLinePlots = false; |
| 1378 var shouldIgnoreMemory= true; | |
| 1379 var referenceIndex = 0; | 1433 var referenceIndex = 0; |
| 1380 | 1434 |
| 1381 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeLineP lots); | 1435 var testTypeSelector = new TestTypeSelector(metrics); |
| 1436 var buttonHTML = testTypeSelector.buildButtonHTMLForUsedTestTypes(); | |
| 1437 $('#time-memory').append(buttonHTML); | |
| 1382 | 1438 |
| 1383 $('#time-memory').bind('change', function (event, checkedElement) { | 1439 $('#scatter-line').bind('change', function(event, checkedElement) { |
| 1384 shouldIgnoreMemory = checkedElement.textContent == 'Time'; | 1440 useLargeLinePlots = checkedElement.textContent == 'Line'; |
| 1385 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeL inePlots); | 1441 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); |
| 1386 }); | 1442 }); |
| 1387 | 1443 |
| 1388 $('#scatter-line').bind('change', function (event, checkedElement) { | 1444 runs.map(function(run, index) { |
| 1389 useLargeLinePlots = checkedElement.textContent == 'Line'; | |
| 1390 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeL inePlots); | |
| 1391 }); | |
| 1392 | |
| 1393 runs.map(function (run, index) { | |
| 1394 $('#reference').append('<span value="' + index + '"' + (index == referen ceIndex ? ' class="checked"' : '') + ' title="' + run.description() + '">' + run .label() + '</span>'); | 1445 $('#reference').append('<span value="' + index + '"' + (index == referen ceIndex ? ' class="checked"' : '') + ' title="' + run.description() + '">' + run .label() + '</span>'); |
| 1395 }) | 1446 }) |
| 1396 | 1447 |
| 1397 $('#reference').bind('change', function (event, checkedElement) { | 1448 $('#time-memory').bind('change', function(event, checkedElement) { |
| 1398 referenceIndex = parseInt(checkedElement.getAttribute('value')); | 1449 testTypeSelector.testTypeName = checkedElement.textContent; |
| 1399 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeL inePlots); | 1450 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); |
| 1400 }); | 1451 }); |
| 1401 | 1452 |
| 1402 $('.checkbox').each(function (index, checkbox) { | 1453 $('#reference').bind('change', function(event, checkedElement) { |
| 1403 $(checkbox).children('span').click(function (event) { | 1454 referenceIndex = parseInt(checkedElement.getAttribute('value')); |
| 1455 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); | |
| 1456 }); | |
| 1457 | |
| 1458 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLinePl ots); | |
| 1459 | |
| 1460 $('.checkbox').each(function(index, checkbox) { | |
| 1461 $(checkbox).children('span').click(function(event) { | |
| 1404 if ($(this).hasClass('checked')) | 1462 if ($(this).hasClass('checked')) |
| 1405 return; | 1463 return; |
| 1406 $(checkbox).children('span').removeClass('checked'); | 1464 $(checkbox).children('span').removeClass('checked'); |
| 1407 $(this).addClass('checked'); | 1465 $(this).addClass('checked'); |
| 1408 $(checkbox).trigger('change', $(this)); | 1466 $(checkbox).trigger('change', $(this)); |
| 1409 }); | 1467 }); |
| 1410 }); | 1468 }); |
| 1411 | 1469 |
| 1412 runToUndelete = deletedRunsById[undeleteManager.mostRecentlyDeletedId()]; | 1470 runToUndelete = deletedRunsById[undeleteManager.mostRecentlyDeletedId()]; |
| 1413 | 1471 |
| 1414 if (runToUndelete) { | 1472 if (runToUndelete) { |
| 1415 $('#undelete').html('Undelete ' + runToUndelete.label()); | 1473 $('#undelete').html('Undelete ' + runToUndelete.label()); |
| 1416 $('#undelete').attr('title', runToUndelete.description()); | 1474 $('#undelete').attr('title', runToUndelete.description()); |
| 1417 $('#undelete').click(function (event) { | 1475 $('#undelete').click(function(event) { |
| 1418 runToUndelete.show(); | 1476 runToUndelete.show(); |
| 1419 undeleteManager.undeleteMostRecent(); | 1477 undeleteManager.undeleteMostRecent(); |
| 1420 location.reload(); | 1478 location.reload(); |
| 1421 }); | 1479 }); |
| 1422 } else { | 1480 } else { |
| 1423 $('#undelete').hide(); | 1481 $('#undelete').hide(); |
| 1424 } | 1482 } |
| 1425 } | 1483 } |
| 1426 | 1484 |
| 1427 </script> | 1485 </script> |
| 1428 <script id="results-json" type="application/json">%json_results%</script> | 1486 <script id="results-json" type="application/json">%json_results%</script> |
| 1429 <script id="units-json" type="application/json">%json_units%</script> | 1487 <script id="units-json" type="application/json">%json_units%</script> |
| 1430 </body> | 1488 </body> |
| 1431 </html> | 1489 </html> |
| OLD | NEW |