Open Bug 1594291 Opened 6 years ago Updated 3 years ago

Write test verifying that the responsiveness is correctly captured in the profiler

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

People

(Reporter: mozbugz, Unassigned)

References

Details

Greg wrote in https://phabricator.services.mozilla.com/D51554#1568353 :
I noticed that this code [modifying the sampler to record the responsiveness differently] is being modified, but there is no test in place to assert that that changes are valid. It might be nice to backfill a test here to ensure that we are doing the right thing. I'm putting this as optional due to Randell's bug 1572337 moving this into a different direction. It seems like this would be a good place for an xpcshell test to verify things.

I was thinking something like this:

// Start profiler

info("Do some synchronous JavaScript work in order to record responsiveness values.");
doSyncWork(1000);

function doSyncWork(milliseconds) {
  const start = Date.now();
  while (true) {
    this.n = 0;
    for (let i = 0; i < 1e5; i++) {
      this.n += Math.random();
    }
    if (Date.now() - start > milliseconds) {
      return;
    }
  }
}

// Capture the profile and verify responsiveness values.

It could be good to check the idleness as well, but that's more work.

I see that bug 1572337 is adding an xpcshell test for the new responsiveness measurements, so maybe we won't need more work? To be followed...

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.