性能监控问题

function testPerformance(){
  let performance = window.performance
  let timing = performance.timing
  console.log('白屏时间',timing.responseEnd - timing.navigationStart)
  console.log('页面总下载时间.',timing.loadEventEnd - timing.navigationStart)
  console.log('DNS解析耗时.',timing.domainLookupEnd - timing.domainLookupStart)
  console.log('TCP链接耗时.',timing.connectEnd - timing.connectStart)
  console.log('首包请求耗时.',timing.responseEnd - timing.responseStart)
  console.log('dom解释耗时.',timing.domComplete - timing.domInteractive)
  console.log('用户可操作时间.',timing.domContentLoadedEventEnd - timing.navigationStart)
}
  1. DNS 解析耗时: domainLookupEnd - domainLookupStart
  2. TCP 连接耗时: connectEnd - connectStart
  3. SSL 安全连接耗时: connectEnd - secureConnectionStart
  4. 网络请求耗时 (TTFB): responseStart - requestStart
  5. 数据传输耗时: responseEnd - responseStart
  6. DOM 解析耗时: domInteractive - responseEnd
  7. 资源加载耗时: loadEventStart - domContentLoadedEventEnd
  8. First Byte时间: responseStart - domainLookupStart
  9. 白屏时间: responseEnd - fetchStart
  10. 首次可交互时间: domInteractive - fetchStart
  11. DOM Ready 时间: domContentLoadEventEnd - fetchStart
  12. 页面完全加载时间: loadEventStart - fetchStart
  13. http 头部大小: transferSize - encodedBodySize
  14. 重定向次数:performance.navigation.redirectCount
  15. 重定向耗时: redirectEnd - redirectStart
posted @ 2020-05-26 14:17  671_MrSix  阅读(112)  评论(0编辑  收藏  举报