"Start profiling and reload page"什么时候决定停止自动录制?

When does "Start profiling and reload page" decide to stop the automatic recording?

我经常使用 Chrome DevTools 中的性能时间轴来捕获我页面的性能记录。

大部分时间我使用"Start profiling and reload page",它会自动开始和停止录音。

问题是:DevTools 何时决定停止录制

我注意到它总是在 "Load" 事件发生后至少几百毫秒继续记录,并试图找出页面何时消失 "mostly idle"。

但这是一个相当模糊的猜测。我很想知道它是否依赖于某些性能事件(例如 "time to interactive" in Lighthouse 中使用的事件)?

目前正在等待 three seconds after load event
这没有记录在案,因此将来可能会更改,恕不另行通知。

this._millisecondsToRecordAfterLoadEvent = 3000;

async _loadEventFired(event) {
  if (this._state !== Timeline.TimelinePanel.State.Recording || !this._recordingPageReload ||
      this._controller.mainTarget() !== event.data.resourceTreeModel.target())
    return;
  const controller = this._controller;
  await new Promise(r => setTimeout(r, this._millisecondsToRecordAfterLoadEvent));

  // Check if we're still in the same recording session.
  if (controller !== this._controller || this._state !== Timeline.TimelinePanel.State.Recording)
    return;
  this._stopRecording();
}