什么时候开始“开始分析并重新加载页面"?决定停止自动录制? [英] When does "Start profiling and reload page" decide to stop the automatic recording?

查看:90
本文介绍了什么时候开始“开始分析并重新加载页面"?决定停止自动录制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I use the Performance Timeline in Chrome DevTools quite a lot to capture performance recordings of my page.

大多数时候,我使用开始配置和重新加载页面",它会自动开始和停止记录.

Most of the time I use the "Start profiling and reload page", which automatically starts and stops the recording.

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

我注意到它总是继续记录加载"事件之后至少几百毫秒,并试图弄清页面何时变为大部分空闲".

I've noticed that it always continues to record at least a few hundred ms past the "Load"-event and tries to figure out when the page has gone "mostly idle".

但这是一个相当模糊的猜测.我想知道它是否依赖于某些表演事件(例如在Lighthouse中的互动时间"中使用的那个事件)?

But that's quite a fuzzy guess. I'd love to know if it relies on some performance event (like the one used in "time to interactive" in Lighthouse)?

推荐答案

当前,它等待

Currently it waits for three seconds after load event.
This is not documented so it may change in the future without notice.

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();
}

这篇关于什么时候开始“开始分析并重新加载页面"?决定停止自动录制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆