Execution time, CPU usage and other questions

Hi Festus,

I moved your post to a separate topic. Please create new topics to avoid derailing the discussion on unrelated topics. And preferably one question per topic, but I’ll try to answer all of your questions here.

  1. You can measure execution time with Date.now(). See this example. This won’t be very precise, but it will give you a reasonable approximation.

    Another thing you can use are k6 groups. They emit a group_duration metric which you can track to get slightly more accurate results.

  1. If you mean analyzing runtime performance like what Chrome DevTools profiling allows, that’s currently not possible.

    Currently you can gather some performance statistics by using the Performance API on the page. For example:

    page.evaluate(() => {
      const entries = performance.getEntries();
      console.log(JSON.stringify(entries));
    });
    

    But this won’t give you any sort of FPS information.

    In upcoming releases we’re planning to add support for page.metrics(), but this also wouldn’t give you a metric like FPS.

    If you want, please create an issue on GitHub explaining your use case and what you would like to measure, and we’ll look into it.

  2. Not currently, no. xk6-browser starts a Chrome process, so do you want to measure the k6 CPU usage or the browser’s, or both?

    I think you can do this outside of k6 with some shell scripting.

  3. It’s difficult to say with certainty without looking into your site and environment specifically. Does this happen on other pages? Can you reproduce it from other machines?

    For me while testing test.k6.io the results are within ~100ms of each test run. There will always be some variation, but I agree that the ~700ms difference in your example is a bit high.

    Can you test with test.k6.io and let us know if you experience the same issue? See this example you can use.

Hope this helps,

Ivan