OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 |
| 5 <meta charset=utf8> |
| 6 |
| 7 <!-- |
| 8 Copyright (C) 2007 Apple Inc. All rights reserved. |
| 9 Copyright (C) 2010 Mozilla Foundation |
| 10 |
| 11 Redistribution and use in source and binary forms, with or without |
| 12 modification, are permitted provided that the following conditions |
| 13 are met: |
| 14 1. Redistributions of source code must retain the above copyright |
| 15 notice, this list of conditions and the following disclaimer. |
| 16 2. Redistributions in binary form must reproduce the above copyright |
| 17 notice, this list of conditions and the following disclaimer in the |
| 18 documentation and/or other materials provided with the distribution. |
| 19 |
| 20 THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 21 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 23 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 24 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 28 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 --> |
| 32 |
| 33 <title>Kraken JavaScript Benchmark (@SUITE@ test suite - In Progress...)</title> |
| 34 <link rel="stylesheet" href="../kraken.css"> |
| 35 </head> |
| 36 |
| 37 <body onload="start()"> |
| 38 <div id="content"> |
| 39 <h2>Kraken JavaScript Benchmark <small>(In Progress...)</small></h2> |
| 40 <div id="results"> |
| 41 |
| 42 <h3>Content Version: @SUITE@</h3> |
| 43 |
| 44 <script src="test-prefix.js"></script> |
| 45 <script src="test-contents.js"></script> |
| 46 <script> |
| 47 var testIndex = -1; |
| 48 var currentRepeat = -1; |
| 49 var repeatCount = 10; |
| 50 |
| 51 var currentSquare = 1; |
| 52 |
| 53 var output = []; |
| 54 output.length = repeatCount; |
| 55 for (var i = 0; i < output.length; i++) { |
| 56 output[i] = {}; |
| 57 } |
| 58 |
| 59 function initSquares() { |
| 60 var squaresDiv = document.getElementById("squares"); |
| 61 var id = 0; |
| 62 for (var i = 0; i < repeatCount; i++) { |
| 63 for (var j = 0; j <= tests.length; j++) { |
| 64 id++; |
| 65 squaresDiv.innerHTML += "<span class='incomplete-square' id='square-
" + id + "'>\u25A0</span>"; |
| 66 } |
| 67 squaresDiv.innerHTML += "<br>"; |
| 68 } |
| 69 } |
| 70 |
| 71 function completeSquare() { |
| 72 var square = document.getElementById("square-" + currentSquare); |
| 73 if (square) { |
| 74 square.className = "complete-square"; |
| 75 currentSquare++; |
| 76 } |
| 77 } |
| 78 |
| 79 function start() |
| 80 { |
| 81 initSquares(); |
| 82 window.setTimeout(reallyNext, 500); |
| 83 } |
| 84 |
| 85 function next() |
| 86 { |
| 87 window.setTimeout(reallyNext, 10); |
| 88 } |
| 89 |
| 90 function reallyNext() |
| 91 { |
| 92 completeSquare(); |
| 93 document.getElementById("frameparent").innerHTML = ""; |
| 94 document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>"
; |
| 95 var testFrame = document.getElementById("testframe"); |
| 96 testIndex++; |
| 97 if (testIndex < tests.length) { |
| 98 testFrame.contentDocument.open(); |
| 99 testFrame.contentDocument.write(testContents[testIndex]); |
| 100 testFrame.contentDocument.close; |
| 101 } else if (++currentRepeat < repeatCount) { |
| 102 testIndex = 0; |
| 103 testFrame.contentDocument.open(); |
| 104 testFrame.contentDocument.write(testContents[testIndex]); |
| 105 testFrame.contentDocument.close; |
| 106 } else { |
| 107 finish(); |
| 108 } |
| 109 } |
| 110 |
| 111 function recordResult(time) |
| 112 { |
| 113 if (currentRepeat >= 0) // negative repeats are warmups |
| 114 output[currentRepeat][tests[testIndex]] = time; |
| 115 next(); |
| 116 } |
| 117 |
| 118 function finish() |
| 119 { |
| 120 var outputString = "{"; |
| 121 outputString += '"v": "@SUITE@", '; |
| 122 for (var test in output[0]) { |
| 123 outputString += '"' + test + '":['; |
| 124 for (var i = 0; i < output.length; i++) { |
| 125 outputString += output[i][test] + ","; |
| 126 } |
| 127 outputString = outputString.substring(0, outputString.length - 1); |
| 128 outputString += "],"; |
| 129 } |
| 130 outputString = outputString.substring(0, outputString.length - 1); |
| 131 outputString += "}"; |
| 132 |
| 133 location = "results.html?" + encodeURI(outputString); |
| 134 } |
| 135 |
| 136 </script> |
| 137 |
| 138 <div id="frameparent"> |
| 139 </div> |
| 140 <div id="squares"></div> |
| 141 </div> |
| 142 </div> |
| 143 </body> |
| 144 </html> |
OLD | NEW |