async function collectFeatureTraceEvents(browser) {
  const page = await browser.newPage();

  console.log(chalk.cyan(`Trace started.`));

  await page.tracing.start({
    categories: [
      '-*',
      'disabled-by-default-devtools.timeline', // for TracingStartedInPage
      'disabled-by-default-blink.feature_usage'
    ],
  });
  console.log(chalk.cyan(`Navigating to ${url}`));
  await page.goto(url, {waitUntil: 'networkidle2'});
  console.log(chalk.cyan(`Waiting for page to be idle...`));
  await page.waitFor(5000); // add a little more time in case other features are used.
  const trace = JSON.parse(await page.tracing.stop());
  console.log(chalk.cyan(`Trace complete.`));

  // Filter out all trace events that aren't 1. blink feature usage
  // and 2. from the same process/thread id as our test page's main thread.
  const traceStartEvent = findTraceStartEvent(trace.traceEvents);
  const events = trace.traceEvents.filter(e => {
    return e.cat === 'disabled-by-default-blink.feature_usage' &&
           e.pid === traceStartEvent.pid && e.tid === traceStartEvent.tid;
  });

  // // Gut check.
  // console.assert(events.every((entry, i, arr) => {
  //   // const nextIdx = Math.min(i + 1, arr.length - 1);
  //   // return entry.pid === arr[nextIdx].pid && entry.tid === arr[nextIdx].tid;
  //   return entry.pid === traceStartEvent.pid && entry.tid === traceStartEvent.tid;
  // }), 'Trace event is not from the same process/thread id as the page being tested.');

  await page.close();

  return events;
}
Start a trace during load to capture web platform features used by the page.
@param {!Browser} browser
@return {!Object}