private _calcTotalTime()

in src/plugins/network.ts [318:340]


  private _calcTotalTime(
    entry: NetworkInfo,
    rtiming: ReturnType<Request['timing']>
  ) {
    const timings = entry.timings;
    entry.timings.total = [
      timings.blocked,
      timings.dns,
      timings.connect,
      timings.wait,
      timings.receive,
    ].reduce((pre, cur) => ((cur || -1) > 0 ? cur + pre : pre), 0);

    // fallback when ResourceTiming data is not available
    if (rtiming.startTime <= 0) {
      const end =
        entry.loadEndTime ||
        entry.responseReceivedTime ||
        entry.requestSentTime;
      const total = roundMilliSecs((end - entry.requestSentTime) * 1000);
      entry.timings.total = total <= 0 ? -1 : total;
    }
  }