| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 this.angle += Math.PI / 90.0; | 347 this.angle += Math.PI / 90.0; |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 | 350 |
| 351 function updateStats(pause) { | 351 function updateStats(pause) { |
| 352 numberOfFrames++; | 352 numberOfFrames++; |
| 353 if (pause > 20) { | 353 if (pause > 20) { |
| 354 sumOfSquaredPauses += (pause - 20) * (pause - 20); | 354 sumOfSquaredPauses += (pause - 20) * (pause - 20); |
| 355 } | 355 } |
| 356 pauseDistribution[pause / 10] |= 0; | 356 pauseDistribution[Math.floor(pause / 10)] |= 0; |
| 357 pauseDistribution[pause / 10]++; | 357 pauseDistribution[Math.floor(pause / 10)]++; |
| 358 } | 358 } |
| 359 | 359 |
| 360 | 360 |
| 361 function renderStats() { | 361 function renderStats() { |
| 362 var msg = document.createElement("p"); | 362 var msg = document.createElement("p"); |
| 363 msg.innerHTML = "Score " + | 363 msg.innerHTML = "Score " + |
| 364 Math.round(numberOfFrames * 1000 / sumOfSquaredPauses); | 364 Math.round(numberOfFrames * 1000 / sumOfSquaredPauses); |
| 365 var table = document.createElement("table"); | 365 var table = document.createElement("table"); |
| 366 table.align = "center"; | 366 table.align = "center"; |
| 367 for (var i = 0; i < pauseDistribution.length; i++) { | 367 for (var i = 0; i < pauseDistribution.length; i++) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 446 } |
| 447 | 447 |
| 448 function start() { | 448 function start() { |
| 449 benchmarkTimeLimit = document.getElementById("timelimit").value * 1000; | 449 benchmarkTimeLimit = document.getElementById("timelimit").value * 1000; |
| 450 document.body.removeChild(form); | 450 document.body.removeChild(form); |
| 451 init(); | 451 init(); |
| 452 render(); | 452 render(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 renderForm(); | 455 renderForm(); |
| OLD | NEW |