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 buildButtonHTMLFromButtonNames(buttonNames, activeButton) { | |
|
petrcermak
2015/12/17 11:17:15
nit: s/activeButton/activeButtonName/ (this way it
petrcermak
2015/12/17 11:17:15
This function requires too much work on the part o
picksi
2015/12/21 17:01:11
Done.
| |
| 694 var buttonHTML = ""; | |
| 695 for (var button in buttonNames) { | |
|
petrcermak
2015/12/17 11:17:15
You should *never* iterate over an array in JS lik
picksi
2015/12/21 17:01:12
I find your version a little dense, but I've used
| |
| 696 var buttonName = buttonNames[button]; | |
| 697 var classType = buttonName === activeButton ? 'class=checked' : ''; | |
|
petrcermak
2015/12/17 11:17:15
supernit: I think "classAttribute" is more precise
picksi
2015/12/21 17:01:11
Done.
| |
| 698 buttonHTML += '<span ' + classType + '>' + buttonName + '</span>'; | |
|
petrcermak
2015/12/17 11:17:15
nit: This will result in "<span >" for inactive bu
picksi
2015/12/21 17:01:11
Done.
| |
| 699 } | |
| 700 return buttonHTML; | |
| 701 } | |
| 702 | |
| 703 function TestTypeSelector(tests) { | |
| 704 this.buttonNames = this.generateButtonHTML(tests); | |
|
petrcermak
2015/12/17 11:17:15
This should be called "testTypeNames". You use its
picksi
2015/12/21 17:01:11
Done.
| |
| 705 } | |
| 706 | |
| 707 TestTypeSelector.prototype = { | |
| 708 recognizers: { | |
|
petrcermak
2015/12/17 11:17:15
I've just realized that you do modify the list of
picksi
2015/12/21 17:01:12
Done.
| |
| 709 'Time': function(test) { return test.isMemoryTest(); }, | |
|
petrcermak
2015/12/17 11:17:15
style: It's usually discouraged to vertically alig
picksi
2015/12/21 17:01:12
Done.
| |
| 710 'Memory': function(test) { return !test.isMemoryTest(); } | |
| 711 }, | |
| 712 | |
|
petrcermak
2015/12/17 11:17:15
Please change this to a setter:
set testTypeName(
picksi
2015/12/21 17:01:12
Done.
| |
| 713 setTestTypeByName: function(testType) { | |
| 714 this.recognizerDelegate = this.recognizers[testType]; | |
| 715 }, | |
| 716 | |
| 717 shouldShowTest: function(test) { | |
|
petrcermak
2015/12/17 11:17:15
This function seems to be an unnecessary proxy to
picksi
2015/12/21 17:01:12
This is cool! JS is awesome in its weirdness.
| |
| 718 return this.recognizerDelegate(test); | |
| 719 }, | |
| 720 | |
| 721 generateButtonHTML: function(tests) { | |
|
petrcermak
2015/12/17 11:17:15
This function does not generate HTML code anymore,
picksi
2015/12/21 17:01:11
D'Oh. Done!
| |
| 722 var buttonNames = []; | |
| 723 | |
| 724 for (var buttonName in this.recognizers) { | |
| 725 this.setTestTypeByName(buttonName) | |
| 726 for (var testName in tests) { | |
| 727 var test = tests[testName]; | |
| 728 if (this.shouldShowTest(test)) { | |
| 729 // This is a test that is recognized so add a checkbox for i t. | |
| 730 buttonNames.push(buttonName); | |
| 731 break; | |
| 732 } | |
| 733 } | |
| 734 } | |
| 735 | |
| 736 if (buttonNames.length == 0) { | |
|
petrcermak
2015/12/17 11:17:15
nit: s/==/===/
| |
| 737 // Add 'no results' button if there are no results | |
| 738 var newButtonName = 'No Results'; | |
| 739 this.recognizers[newButtonName] = function(){return false;}; | |
|
petrcermak
2015/12/17 11:17:15
nit: spaces in function
picksi
2015/12/21 17:01:12
Done.
| |
| 740 buttonNames.push(newButtonName); | |
| 741 } else if (buttonNames.length > 1) { | |
| 742 // If we have more than one test add an 'all' button. | |
| 743 var newButtonName = 'All'; | |
| 744 this.recognizers[newButtonName] = function(){return true;}; | |
|
petrcermak
2015/12/17 11:17:15
ditto
picksi
2015/12/21 17:01:12
Done.
| |
| 745 buttonNames.push(newButtonName); | |
| 746 } | |
| 747 | |
| 748 return buttonNames; | |
| 749 } | |
| 750 }; | |
| 751 | |
| 693 var topLevelRows; | 752 var topLevelRows; |
| 694 var allTableRows; | 753 var allTableRows; |
| 695 | 754 |
| 696 function createTable(tests, runs, shouldIgnoreMemory, referenceIndex, useLargeLi nePlots) { | 755 function displayTable(tests, runs, testTypeSelector, referenceIndex, useLargeLin ePlots) { |
| 697 var resultHeaders = runs.map(function (run, index) { | 756 var resultHeaders = runs.map(function(run, index) { |
| 698 var header = '<th id="' + run.id() + '" ' + | 757 var header = '<th id="' + run.id() + '" ' + |
| 699 'colspan=2 ' + | 758 'colspan=2 ' + |
| 700 'title="' + run.description() + '">' + | 759 'title="' + run.description() + '">' + |
| 701 '<span class="label" ' + | 760 '<span class="label" ' + |
| 702 'title="Edit run label">' + | 761 'title="Edit run label">' + |
| 703 run.label() + | 762 run.label() + |
| 704 '</span>' + | 763 '</span>' + |
| 705 '<div class="closeButton" ' + | 764 '<div class="closeButton" ' + |
| 706 'title="Delete run">' + | 765 'title="Delete run">' + |
| 707 '×' + | 766 '×' + |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 | 801 |
| 743 $('#container').html(htmlString); | 802 $('#container').html(htmlString); |
| 744 | 803 |
| 745 var testNames = []; | 804 var testNames = []; |
| 746 for (testName in tests) | 805 for (testName in tests) |
| 747 testNames.push(testName); | 806 testNames.push(testName); |
| 748 | 807 |
| 749 allTableRows = []; | 808 allTableRows = []; |
| 750 testNames.forEach(function(testName) { | 809 testNames.forEach(function(testName) { |
| 751 var test = tests[testName]; | 810 var test = tests[testName]; |
| 752 if (test.isMemoryTest() === shouldIgnoreMemory) { | 811 if (testTypeSelector.shouldShowTest(test)) { |
| 753 return; | 812 allTableRows.push(new TableRow(runs, test, referenceIndex, useLargeL inePlots)); |
| 754 } | 813 } |
| 755 allTableRows.push(new TableRow(runs, test, referenceIndex, useLargeLineP lots)); | |
| 756 }); | 814 }); |
| 757 | 815 |
| 758 // Build a list of top level rows with attached children | 816 // Build a list of top level rows with attached children |
| 759 topLevelRows = []; | 817 topLevelRows = []; |
| 760 allTableRows.forEach(function(row) { | 818 allTableRows.forEach(function(row) { |
| 761 // Add us to top level if we are a top-level row... | 819 // Add us to top level if we are a top-level row... |
| 762 if (row.hasNoURL) { | 820 if (row.hasNoURL) { |
| 763 topLevelRows.push(row); | 821 topLevelRows.push(row); |
| 764 // Add a duplicate child row that holds the graph for the parent | 822 // Add a duplicate child row that holds the graph for the parent |
| 765 var graphHolder = new TableRow(runs, row.test, referenceIndex, useLa rgeLinePlots); | 823 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() { | 879 $('#labelEditor').focusout(function() { |
| 822 runs[i].setLabel(this.value); | 880 runs[i].setLabel(this.value); |
| 823 location.reload(); | 881 location.reload(); |
| 824 }); | 882 }); |
| 825 $('#labelEditor').keypress(function(event) { | 883 $('#labelEditor').keypress(function(event) { |
| 826 if (event.which == 13) { | 884 if (event.which == 13) { |
| 827 runs[i].setLabel(this.value); | 885 runs[i].setLabel(this.value); |
| 828 location.reload(); | 886 location.reload(); |
| 829 } | 887 } |
| 830 }); | 888 }); |
| 831 $('#labelEditor').click(function (event) { | 889 $('#labelEditor').click(function(event) { |
| 832 event.stopPropagation(); | 890 event.stopPropagation(); |
| 833 }); | 891 }); |
| 834 $('#labelEditor').mousedown(function (event) { | 892 $('#labelEditor').mousedown(function(event) { |
| 835 event.stopPropagation(); | 893 event.stopPropagation(); |
| 836 }); | 894 }); |
| 837 $('#labelEditor').select(); | 895 $('#labelEditor').select(); |
| 838 break; | 896 break; |
| 839 } | 897 } |
| 840 } | 898 } |
| 841 event.stopPropagation(); | 899 event.stopPropagation(); |
| 842 }); | 900 }); |
| 843 } | 901 } |
| 844 | 902 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1336 } else { | 1394 } else { |
| 1337 this.openRow(); | 1395 this.openRow(); |
| 1338 } | 1396 } |
| 1339 return false; | 1397 return false; |
| 1340 } | 1398 } |
| 1341 | 1399 |
| 1342 function init() { | 1400 function init() { |
| 1343 var runs = []; | 1401 var runs = []; |
| 1344 var metrics = {}; | 1402 var metrics = {}; |
| 1345 var deletedRunsById = {}; | 1403 var deletedRunsById = {}; |
| 1346 $.each(JSON.parse(document.getElementById('results-json').textContent), func tion (index, entry) { | 1404 $.each(JSON.parse(document.getElementById('results-json').textContent), func tion(index, entry) { |
| 1347 var run = new TestRun(entry); | 1405 var run = new TestRun(entry); |
| 1348 if (run.isHidden()) { | 1406 if (run.isHidden()) { |
| 1349 deletedRunsById[run.id()] = run; | 1407 deletedRunsById[run.id()] = run; |
| 1350 return; | 1408 return; |
| 1351 } | 1409 } |
| 1352 | 1410 |
| 1353 runs.push(run); | 1411 runs.push(run); |
| 1354 | 1412 |
| 1355 function addTests(tests) { | 1413 function addTests(tests) { |
| 1356 for (var testName in tests) { | 1414 for (var testName in tests) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1368 new TestResult(metric, rawMetrics[metricName].current, | 1426 new TestResult(metric, rawMetrics[metricName].current, |
| 1369 run, rawMetrics[metricName]['std'], rawMetrics[metri cName]['degrees_of_freedom'])); | 1427 run, rawMetrics[metricName]['std'], rawMetrics[metri cName]['degrees_of_freedom'])); |
| 1370 } | 1428 } |
| 1371 } | 1429 } |
| 1372 } | 1430 } |
| 1373 | 1431 |
| 1374 addTests(entry.tests); | 1432 addTests(entry.tests); |
| 1375 }); | 1433 }); |
| 1376 | 1434 |
| 1377 var useLargeLinePlots = false; | 1435 var useLargeLinePlots = false; |
| 1378 var shouldIgnoreMemory= true; | |
| 1379 var referenceIndex = 0; | 1436 var referenceIndex = 0; |
| 1380 | 1437 |
| 1381 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeLineP lots); | 1438 $('#scatter-line').bind('change', function(event, checkedElement) { |
| 1382 | 1439 useLargeLinePlots = checkedElement.textContent == 'Line'; |
|
petrcermak
2015/12/17 11:17:15
You're creating a global variable here. Please pre
picksi
2015/12/21 17:01:11
Yes, this is nasty and is part of the original cod
| |
| 1383 $('#time-memory').bind('change', function (event, checkedElement) { | 1440 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); |
| 1384 shouldIgnoreMemory = checkedElement.textContent == 'Time'; | |
| 1385 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeL inePlots); | |
| 1386 }); | 1441 }); |
| 1387 | 1442 |
| 1388 $('#scatter-line').bind('change', function (event, checkedElement) { | 1443 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>'); | 1444 $('#reference').append('<span value="' + index + '"' + (index == referen ceIndex ? ' class="checked"' : '') + ' title="' + run.description() + '">' + run .label() + '</span>'); |
| 1395 }) | 1445 }) |
| 1396 | 1446 |
| 1397 $('#reference').bind('change', function (event, checkedElement) { | 1447 $('#time-memory').bind('change', function(event, checkedElement) { |
| 1398 referenceIndex = parseInt(checkedElement.getAttribute('value')); | 1448 testTypeSelector.setTestTypeByName(checkedElement.textContent); |
| 1399 createTable(metrics, runs, shouldIgnoreMemory, referenceIndex, useLargeL inePlots); | 1449 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); |
| 1400 }); | 1450 }); |
| 1401 | 1451 |
| 1402 $('.checkbox').each(function (index, checkbox) { | 1452 $('#reference').bind('change', function(event, checkedElement) { |
| 1403 $(checkbox).children('span').click(function (event) { | 1453 referenceIndex = parseInt(checkedElement.getAttribute('value')); |
|
petrcermak
2015/12/17 11:17:15
Again, needs 'var'
picksi
2015/12/21 17:01:12
See comment about useLargeLineplots.
| |
| 1454 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLi nePlots); | |
| 1455 }); | |
| 1456 | |
| 1457 var testTypeSelector = new TestTypeSelector(metrics); | |
|
petrcermak
2015/12/17 11:17:15
I suggest that you move the whole initialization o
picksi
2015/12/21 17:01:11
Done.
| |
| 1458 var initialTestName = testTypeSelector.buttonNames[0]; | |
|
petrcermak
2015/12/17 11:17:15
I can see that there is a certain benefit in setti
picksi
2015/12/21 17:01:12
OK. I've done a 360 on this. I've moved the HTML g
| |
| 1459 var buttonHTML = buildButtonHTMLFromButtonNames(testTypeSelector.buttonNames , initialTestName); | |
| 1460 $('#time-memory').append(buttonHTML); | |
| 1461 | |
| 1462 testTypeSelector.setTestTypeByName(initialTestName); | |
| 1463 displayTable(metrics, runs, testTypeSelector, referenceIndex, useLargeLinePl ots); | |
| 1464 | |
| 1465 $('.checkbox').each(function(index, checkbox) { | |
| 1466 $(checkbox).children('span').click(function(event) { | |
| 1404 if ($(this).hasClass('checked')) | 1467 if ($(this).hasClass('checked')) |
| 1405 return; | 1468 return; |
| 1406 $(checkbox).children('span').removeClass('checked'); | 1469 $(checkbox).children('span').removeClass('checked'); |
| 1407 $(this).addClass('checked'); | 1470 $(this).addClass('checked'); |
| 1408 $(checkbox).trigger('change', $(this)); | 1471 $(checkbox).trigger('change', $(this)); |
| 1409 }); | 1472 }); |
| 1410 }); | 1473 }); |
| 1411 | 1474 |
| 1412 runToUndelete = deletedRunsById[undeleteManager.mostRecentlyDeletedId()]; | 1475 runToUndelete = deletedRunsById[undeleteManager.mostRecentlyDeletedId()]; |
| 1413 | 1476 |
| 1414 if (runToUndelete) { | 1477 if (runToUndelete) { |
| 1415 $('#undelete').html('Undelete ' + runToUndelete.label()); | 1478 $('#undelete').html('Undelete ' + runToUndelete.label()); |
| 1416 $('#undelete').attr('title', runToUndelete.description()); | 1479 $('#undelete').attr('title', runToUndelete.description()); |
| 1417 $('#undelete').click(function (event) { | 1480 $('#undelete').click(function(event) { |
| 1418 runToUndelete.show(); | 1481 runToUndelete.show(); |
| 1419 undeleteManager.undeleteMostRecent(); | 1482 undeleteManager.undeleteMostRecent(); |
| 1420 location.reload(); | 1483 location.reload(); |
| 1421 }); | 1484 }); |
| 1422 } else { | 1485 } else { |
| 1423 $('#undelete').hide(); | 1486 $('#undelete').hide(); |
| 1424 } | 1487 } |
| 1425 } | 1488 } |
| 1426 | 1489 |
| 1427 </script> | 1490 </script> |
| 1428 <script id="results-json" type="application/json">%json_results%</script> | 1491 <script id="results-json" type="application/json">%json_results%</script> |
| 1429 <script id="units-json" type="application/json">%json_units%</script> | 1492 <script id="units-json" type="application/json">%json_units%</script> |
| 1430 </body> | 1493 </body> |
| 1431 </html> | 1494 </html> |
| OLD | NEW |