Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 5 | |
michael@0 | 6 | <window title="Performance measurement tests" |
michael@0 | 7 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 8 | onload="test()"> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript"><![CDATA[ |
michael@0 | 16 | function test() |
michael@0 | 17 | { |
michael@0 | 18 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 19 | |
michael@0 | 20 | Components.utils.import("resource://gre/modules/PerfMeasurement.jsm"); |
michael@0 | 21 | let pm = new PerfMeasurement(PerfMeasurement.ALL); |
michael@0 | 22 | if (pm.eventsMeasured == 0) { |
michael@0 | 23 | todo(false, "stub, skipping test"); |
michael@0 | 24 | } else { |
michael@0 | 25 | pm.start(); |
michael@0 | 26 | for (let i = 0; i < 10000; i++) ; |
michael@0 | 27 | pm.stop(); |
michael@0 | 28 | |
michael@0 | 29 | events = ["cpu_cycles", "instructions", "cache_references", "cache_misses", |
michael@0 | 30 | "branch_instructions", "branch_misses", "bus_cycles", "page_faults", |
michael@0 | 31 | "major_page_faults", "context_switches", "cpu_migrations"]; |
michael@0 | 32 | |
michael@0 | 33 | for (var i = 0; i < events.length; i++) { |
michael@0 | 34 | var e = events[i]; |
michael@0 | 35 | ((pm.eventsMeasured & PerfMeasurement[e.toUpperCase()]) ? isnot : todo_is)(pm[e], -1, e); |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | SimpleTest.finish(); |
michael@0 | 39 | } |
michael@0 | 40 | ]]></script> |
michael@0 | 41 | |
michael@0 | 42 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 43 | <p id="display"></p> |
michael@0 | 44 | <div id="content" style="display:none;"></div> |
michael@0 | 45 | <pre id="test"></pre> |
michael@0 | 46 | </body> |
michael@0 | 47 | <label id="test-result"/> |
michael@0 | 48 | </window> |