Here's a hack that I wrote that waits for the instantiator to settle out, then profiles for a bit. You could use this to make a profile of a running application use case:

  <text id="myoutput" multiline="true" />

  <handler name="oninited">
    LzTimeKernel.setTimeout(function () {
      if (lz.Instantiator.isUpdating) {
        // If the instantiator is still running, just requeue ourselves
        LzTimeKernel.setTimeout(arguments.callee, 10 * 1000);
      } else {
        // Wait a bit for things to settle
        LzTimeKernel.setTimeout(function () {
          myoutput.bringToFront();
myoutput.format("LzIdleKernel.__callbacks: %w\n", LzIdleKernel.__callbacks);
          myoutput.addFormat("lz.Idle.coi: %w\n", lz.Idle.coi);
          if ($profile) {
            Profiler.stop();
            myoutput.addFormat("Starting profiling...");
            Profiler.start();
            // Profile for 40 seconds
            LzTimeKernel.setTimeout(function () {
              Profiler.stop();
              myoutput.addFormat(" done!\n");
            }, 40 * 1000);
          }
        }, 10 * 1000);
      }
    }, 10 * 1000);
  </handler>

Reply via email to