1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/perf/test_pm.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +<?xml version="1.0"?> 1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.6 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.8 + 1.9 +<window title="Performance measurement tests" 1.10 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.11 + onload="test()"> 1.12 + 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 1.15 + <script type="application/javascript" 1.16 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 1.17 + 1.18 + <script type="application/javascript"><![CDATA[ 1.19 +function test() 1.20 +{ 1.21 + SimpleTest.waitForExplicitFinish(); 1.22 + 1.23 + Components.utils.import("resource://gre/modules/PerfMeasurement.jsm"); 1.24 + let pm = new PerfMeasurement(PerfMeasurement.ALL); 1.25 + if (pm.eventsMeasured == 0) { 1.26 + todo(false, "stub, skipping test"); 1.27 + } else { 1.28 + pm.start(); 1.29 + for (let i = 0; i < 10000; i++) ; 1.30 + pm.stop(); 1.31 + 1.32 + events = ["cpu_cycles", "instructions", "cache_references", "cache_misses", 1.33 + "branch_instructions", "branch_misses", "bus_cycles", "page_faults", 1.34 + "major_page_faults", "context_switches", "cpu_migrations"]; 1.35 + 1.36 + for (var i = 0; i < events.length; i++) { 1.37 + var e = events[i]; 1.38 + ((pm.eventsMeasured & PerfMeasurement[e.toUpperCase()]) ? isnot : todo_is)(pm[e], -1, e); 1.39 + } 1.40 + } 1.41 + SimpleTest.finish(); 1.42 +} 1.43 +]]></script> 1.44 + 1.45 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.46 + <p id="display"></p> 1.47 + <div id="content" style="display:none;"></div> 1.48 + <pre id="test"></pre> 1.49 + </body> 1.50 + <label id="test-result"/> 1.51 +</window>