toolkit/components/perf/test_pm.xul
author Paul Adenot <paul@paul.cx>
Tue, 04 Sep 2012 16:22:34 -0700
changeset 104356 a027c9d63d20d697f61832f324077eb0c8cbef7c
parent 94484 f4157e8c410708d76703f19e4dfb61859bfe32d8
child 121589 d2175a963653c49d8331531c9586a84215f6c7f0
permissions -rw-r--r--
Bug 567077 - Sniff types of media files that are served with no Content-Type. r=cpearce

<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<window title="Performance measurement tests"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="test()">

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>

  <script type="application/javascript"><![CDATA[
function test()
{
  SimpleTest.waitForExplicitFinish();

  Components.utils.import("resource://gre/modules/PerfMeasurement.jsm");
  let pm = new PerfMeasurement(PerfMeasurement.ALL);
  if (pm.eventsMeasured == 0) {
    todo(false, "stub, skipping test");
  } else {
    is(pm.eventsMeasured, PerfMeasurement.ALL, "all events measurable");

    pm.start();
    for (let i = 0; i < 10000; i++) ;
      pm.stop();

    isnot(pm.cpu_cycles, -1, "cpu_cycles");
    isnot(pm.instructions, -1, "instructions");
    isnot(pm.cache_references, -1, "cache_references");
    isnot(pm.cache_misses, -1, "cache_misses");
    isnot(pm.branch_instructions, -1, "branch_instructions");
    isnot(pm.branch_misses, -1, "branch_misses");
    isnot(pm.bus_cycles, -1, "bus_cycles");
    isnot(pm.page_faults, -1, "page_faults");
    isnot(pm.major_page_faults, -1, "major_page_faults");
    isnot(pm.context_switches, -1, "context_switches");
    isnot(pm.cpu_migrations, -1, "cpu_migrations");
  }
  SimpleTest.finish();
}
]]></script>

  <body xmlns="http://www.w3.org/1999/xhtml">
    <p id="display"></p>
    <div id="content" style="display:none;"></div>
    <pre id="test"></pre>
  </body>
  <label id="test-result"/>
</window>