@paulirish/trace_engine 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/platform/TypedArrayUtilities.d.ts +7 -0
- package/core/platform/TypedArrayUtilities.js +41 -0
- package/core/platform/TypedArrayUtilities.js.map +1 -1
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/core/platform/platform-tsconfig.json +0 -1
- package/generated/protocol.d.ts +36 -2
- package/models/cpu_profile/cpu_profile-tsconfig.json +0 -1
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/LanternComputationData.d.ts +8 -0
- package/models/trace/LanternComputationData.js +368 -0
- package/models/trace/LanternComputationData.js.map +1 -0
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/extras/extras-tsconfig.json +0 -1
- package/models/trace/handlers/EnhancedTracesHandler.d.ts +46 -0
- package/models/trace/handlers/EnhancedTracesHandler.js +137 -0
- package/models/trace/handlers/EnhancedTracesHandler.js.map +1 -0
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.js +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/ModelHandlers.d.ts +1 -0
- package/models/trace/handlers/ModelHandlers.js +1 -0
- package/models/trace/handlers/ModelHandlers.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +6 -0
- package/models/trace/handlers/UserInteractionsHandler.js +15 -0
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/handlers/handlers-tsconfig.json +1 -1
- package/models/trace/helpers/Timing.d.ts +0 -6
- package/models/trace/helpers/Timing.js +0 -76
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/helpers/helpers-tsconfig.json +0 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/insights/insights-tsconfig.json +0 -1
- package/models/trace/lantern/BaseNode.d.ts +91 -0
- package/models/trace/lantern/BaseNode.js +268 -0
- package/models/trace/lantern/BaseNode.js.map +1 -0
- package/models/trace/lantern/CPUNode.d.ts +24 -0
- package/models/trace/lantern/CPUNode.js +64 -0
- package/models/trace/lantern/CPUNode.js.map +1 -0
- package/models/trace/lantern/LanternError.d.ts +3 -0
- package/models/trace/lantern/LanternError.js +7 -0
- package/models/trace/lantern/LanternError.js.map +1 -0
- package/models/trace/lantern/MetricsModule.d.ts +11 -0
- package/models/trace/lantern/MetricsModule.js +14 -0
- package/models/trace/lantern/MetricsModule.js.map +1 -0
- package/models/trace/lantern/NetworkNode.d.ts +22 -0
- package/models/trace/lantern/NetworkNode.js +83 -0
- package/models/trace/lantern/NetworkNode.js.map +1 -0
- package/models/trace/lantern/PageDependencyGraph.d.ts +43 -0
- package/models/trace/lantern/PageDependencyGraph.js +509 -0
- package/models/trace/lantern/PageDependencyGraph.js.map +1 -0
- package/models/trace/lantern/SimulationModule.d.ts +17 -0
- package/models/trace/lantern/SimulationModule.js +13 -0
- package/models/trace/lantern/SimulationModule.js.map +1 -0
- package/models/trace/lantern/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/core/LanternError.d.ts +3 -0
- package/models/trace/lantern/core/LanternError.js +7 -0
- package/models/trace/lantern/core/LanternError.js.map +1 -0
- package/models/trace/lantern/core/NetworkAnalyzer.d.ts +112 -0
- package/models/trace/lantern/core/NetworkAnalyzer.js +486 -0
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -0
- package/models/trace/lantern/core/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/core/core-tsconfig.json +43 -0
- package/models/trace/lantern/core/core.d.ts +2 -0
- package/models/trace/lantern/core/core.js +6 -0
- package/models/trace/lantern/core/core.js.map +1 -0
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/graph/BaseNode.d.ts +91 -0
- package/models/trace/lantern/graph/BaseNode.js +268 -0
- package/models/trace/lantern/graph/BaseNode.js.map +1 -0
- package/models/trace/lantern/graph/CPUNode.d.ts +24 -0
- package/models/trace/lantern/graph/CPUNode.js +64 -0
- package/models/trace/lantern/graph/CPUNode.js.map +1 -0
- package/models/trace/lantern/graph/NetworkNode.d.ts +22 -0
- package/models/trace/lantern/graph/NetworkNode.js +83 -0
- package/models/trace/lantern/graph/NetworkNode.js.map +1 -0
- package/models/trace/lantern/graph/PageDependencyGraph.d.ts +43 -0
- package/models/trace/lantern/graph/PageDependencyGraph.js +509 -0
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -0
- package/models/trace/lantern/graph/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/graph/graph-tsconfig.json +48 -0
- package/models/trace/lantern/graph/graph.d.ts +4 -0
- package/models/trace/lantern/graph/graph.js +8 -0
- package/models/trace/lantern/graph/graph.js.map +1 -0
- package/models/trace/lantern/lantern-tsconfig.json +53 -0
- package/models/trace/lantern/lantern.d.ts +6 -0
- package/models/trace/lantern/lantern.js +10 -0
- package/models/trace/lantern/lantern.js.map +1 -0
- package/models/trace/lantern/metrics/FirstContentfulPaint.d.ts +40 -0
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +137 -0
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -0
- package/models/trace/lantern/metrics/Interactive.d.ts +12 -0
- package/models/trace/lantern/metrics/Interactive.js +67 -0
- package/models/trace/lantern/metrics/Interactive.js.map +1 -0
- package/models/trace/lantern/metrics/LargestContentfulPaint.d.ts +17 -0
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +69 -0
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -0
- package/models/trace/lantern/metrics/MaxPotentialFID.d.ts +14 -0
- package/models/trace/lantern/metrics/MaxPotentialFID.js +48 -0
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -0
- package/models/trace/lantern/metrics/Metric.d.ts +44 -0
- package/models/trace/lantern/metrics/Metric.js +70 -0
- package/models/trace/lantern/metrics/Metric.js.map +1 -0
- package/models/trace/lantern/metrics/SpeedIndex.d.ts +25 -0
- package/models/trace/lantern/metrics/SpeedIndex.js +101 -0
- package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -0
- package/models/trace/lantern/metrics/TBTUtils.d.ts +31 -0
- package/models/trace/lantern/metrics/TBTUtils.js +65 -0
- package/models/trace/lantern/metrics/TBTUtils.js.map +1 -0
- package/models/trace/lantern/metrics/TotalBlockingTime.d.ts +16 -0
- package/models/trace/lantern/metrics/TotalBlockingTime.js +78 -0
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -0
- package/models/trace/lantern/metrics/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/metrics/metrics-tsconfig.json +58 -0
- package/models/trace/lantern/metrics/metrics.d.ts +8 -0
- package/models/trace/lantern/metrics/metrics.js +12 -0
- package/models/trace/lantern/metrics/metrics.js.map +1 -0
- package/models/trace/lantern/simulation/ConnectionPool.d.ts +26 -0
- package/models/trace/lantern/simulation/ConnectionPool.js +116 -0
- package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -0
- package/models/trace/lantern/simulation/Constants.d.ts +31 -0
- package/models/trace/lantern/simulation/Constants.js +43 -0
- package/models/trace/lantern/simulation/Constants.js.map +1 -0
- package/models/trace/lantern/simulation/DNSCache.d.ts +22 -0
- package/models/trace/lantern/simulation/DNSCache.js +48 -0
- package/models/trace/lantern/simulation/DNSCache.js.map +1 -0
- package/models/trace/lantern/simulation/NetworkAnalyzer.d.ts +112 -0
- package/models/trace/lantern/simulation/NetworkAnalyzer.js +486 -0
- package/models/trace/lantern/simulation/NetworkAnalyzer.js.map +1 -0
- package/models/trace/lantern/simulation/SimulationTimingMap.d.ts +69 -0
- package/models/trace/lantern/simulation/SimulationTimingMap.js +134 -0
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -0
- package/models/trace/lantern/simulation/Simulator.d.ts +84 -0
- package/models/trace/lantern/simulation/Simulator.js +449 -0
- package/models/trace/lantern/simulation/Simulator.js.map +1 -0
- package/models/trace/lantern/simulation/TCPConnection.d.ts +48 -0
- package/models/trace/lantern/simulation/TCPConnection.js +158 -0
- package/models/trace/lantern/simulation/TCPConnection.js.map +1 -0
- package/models/trace/lantern/simulation/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/simulation/simulation-tsconfig.json +50 -0
- package/models/trace/lantern/simulation/simulation.d.ts +6 -0
- package/models/trace/lantern/simulation/simulation.js +10 -0
- package/models/trace/lantern/simulation/simulation.js.map +1 -0
- package/models/trace/lantern/types/bundle-tsconfig.json +1 -0
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +42 -0
- package/models/trace/lantern/types/lantern.d.ts +199 -0
- package/models/trace/lantern/types/lantern.js +24 -0
- package/models/trace/lantern/types/lantern.js.map +1 -0
- package/models/trace/lantern/types/types-tsconfig.json +42 -0
- package/models/trace/lantern/types/types.d.ts +1 -0
- package/models/trace/lantern/types/types.js +5 -0
- package/models/trace/lantern/types/types.js.map +1 -0
- package/models/trace/root-causes/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/root-causes/root-causes-tsconfig.json +0 -1
- package/models/trace/trace-tsconfig.json +4 -1
- package/models/trace/trace.d.ts +3 -1
- package/models/trace/trace.js +3 -1
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +2 -3
- package/models/trace/types/Extensions.js +2 -11
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +1 -0
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +49 -0
- package/models/trace/types/TraceEvents.js +33 -0
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -1
- package/models/trace/types/types-tsconfig.json +0 -1
- package/package.json +1 -1
- package/PAUL.readme.md +0 -5
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
const INITIAL_CONGESTION_WINDOW = 10;
|
|
5
|
+
const TCP_SEGMENT_SIZE = 1460;
|
|
6
|
+
class TCPConnection {
|
|
7
|
+
_warmed;
|
|
8
|
+
_ssl;
|
|
9
|
+
_h2;
|
|
10
|
+
_rtt;
|
|
11
|
+
_throughput;
|
|
12
|
+
_serverLatency;
|
|
13
|
+
_congestionWindow;
|
|
14
|
+
_h2OverflowBytesDownloaded;
|
|
15
|
+
constructor(rtt, throughput, serverLatency = 0, ssl = true, h2 = false) {
|
|
16
|
+
this._warmed = false;
|
|
17
|
+
this._ssl = ssl;
|
|
18
|
+
this._h2 = h2;
|
|
19
|
+
this._rtt = rtt;
|
|
20
|
+
this._throughput = throughput;
|
|
21
|
+
this._serverLatency = serverLatency;
|
|
22
|
+
this._congestionWindow = INITIAL_CONGESTION_WINDOW;
|
|
23
|
+
this._h2OverflowBytesDownloaded = 0;
|
|
24
|
+
}
|
|
25
|
+
static maximumSaturatedConnections(rtt, availableThroughput) {
|
|
26
|
+
const roundTripsPerSecond = 1000 / rtt;
|
|
27
|
+
const bytesPerRoundTrip = TCP_SEGMENT_SIZE;
|
|
28
|
+
const bytesPerSecond = roundTripsPerSecond * bytesPerRoundTrip;
|
|
29
|
+
const minimumThroughputRequiredPerRequest = bytesPerSecond * 8;
|
|
30
|
+
return Math.floor(availableThroughput / minimumThroughputRequiredPerRequest);
|
|
31
|
+
}
|
|
32
|
+
_computeMaximumCongestionWindowInSegments() {
|
|
33
|
+
const bytesPerSecond = this._throughput / 8;
|
|
34
|
+
const secondsPerRoundTrip = this._rtt / 1000;
|
|
35
|
+
const bytesPerRoundTrip = bytesPerSecond * secondsPerRoundTrip;
|
|
36
|
+
return Math.floor(bytesPerRoundTrip / TCP_SEGMENT_SIZE);
|
|
37
|
+
}
|
|
38
|
+
setThroughput(throughput) {
|
|
39
|
+
this._throughput = throughput;
|
|
40
|
+
}
|
|
41
|
+
setCongestionWindow(congestion) {
|
|
42
|
+
this._congestionWindow = congestion;
|
|
43
|
+
}
|
|
44
|
+
setWarmed(warmed) {
|
|
45
|
+
this._warmed = warmed;
|
|
46
|
+
}
|
|
47
|
+
isWarm() {
|
|
48
|
+
return this._warmed;
|
|
49
|
+
}
|
|
50
|
+
isH2() {
|
|
51
|
+
return this._h2;
|
|
52
|
+
}
|
|
53
|
+
get congestionWindow() {
|
|
54
|
+
return this._congestionWindow;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sets the number of excess bytes that are available to this connection on future downloads, only
|
|
58
|
+
* applies to H2 connections.
|
|
59
|
+
*/
|
|
60
|
+
setH2OverflowBytesDownloaded(bytes) {
|
|
61
|
+
if (!this._h2) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this._h2OverflowBytesDownloaded = bytes;
|
|
65
|
+
}
|
|
66
|
+
clone() {
|
|
67
|
+
return Object.assign(new TCPConnection(this._rtt, this._throughput), this);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Simulates a network download of a particular number of bytes over an optional maximum amount of time
|
|
71
|
+
* and returns information about the ending state.
|
|
72
|
+
*
|
|
73
|
+
* See https://hpbn.co/building-blocks-of-tcp/#three-way-handshake and
|
|
74
|
+
* https://hpbn.co/transport-layer-security-tls/#tls-handshake for details.
|
|
75
|
+
*/
|
|
76
|
+
simulateDownloadUntil(bytesToDownload, options) {
|
|
77
|
+
const { timeAlreadyElapsed = 0, maximumTimeToElapse = Infinity, dnsResolutionTime = 0 } = options || {};
|
|
78
|
+
if (this._warmed && this._h2) {
|
|
79
|
+
bytesToDownload -= this._h2OverflowBytesDownloaded;
|
|
80
|
+
}
|
|
81
|
+
const twoWayLatency = this._rtt;
|
|
82
|
+
const oneWayLatency = twoWayLatency / 2;
|
|
83
|
+
const maximumCongestionWindow = this._computeMaximumCongestionWindowInSegments();
|
|
84
|
+
let handshakeAndRequest = oneWayLatency;
|
|
85
|
+
if (!this._warmed) {
|
|
86
|
+
handshakeAndRequest =
|
|
87
|
+
// DNS lookup
|
|
88
|
+
dnsResolutionTime +
|
|
89
|
+
// SYN
|
|
90
|
+
oneWayLatency +
|
|
91
|
+
// SYN ACK
|
|
92
|
+
oneWayLatency +
|
|
93
|
+
// ACK + initial request
|
|
94
|
+
oneWayLatency +
|
|
95
|
+
// ClientHello/ServerHello assuming TLS False Start is enabled (https://istlsfastyet.com/#server-performance).
|
|
96
|
+
(this._ssl ? twoWayLatency : 0);
|
|
97
|
+
}
|
|
98
|
+
let roundTrips = Math.ceil(handshakeAndRequest / twoWayLatency);
|
|
99
|
+
let timeToFirstByte = handshakeAndRequest + this._serverLatency + oneWayLatency;
|
|
100
|
+
if (this._warmed && this._h2) {
|
|
101
|
+
timeToFirstByte = 0;
|
|
102
|
+
}
|
|
103
|
+
const timeElapsedForTTFB = Math.max(timeToFirstByte - timeAlreadyElapsed, 0);
|
|
104
|
+
const maximumDownloadTimeToElapse = maximumTimeToElapse - timeElapsedForTTFB;
|
|
105
|
+
let congestionWindow = Math.min(this._congestionWindow, maximumCongestionWindow);
|
|
106
|
+
let totalBytesDownloaded = 0;
|
|
107
|
+
if (timeElapsedForTTFB > 0) {
|
|
108
|
+
totalBytesDownloaded = congestionWindow * TCP_SEGMENT_SIZE;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
roundTrips = 0;
|
|
112
|
+
}
|
|
113
|
+
let downloadTimeElapsed = 0;
|
|
114
|
+
let bytesRemaining = bytesToDownload - totalBytesDownloaded;
|
|
115
|
+
while (bytesRemaining > 0 && downloadTimeElapsed <= maximumDownloadTimeToElapse) {
|
|
116
|
+
roundTrips++;
|
|
117
|
+
downloadTimeElapsed += twoWayLatency;
|
|
118
|
+
congestionWindow = Math.max(Math.min(maximumCongestionWindow, congestionWindow * 2), 1);
|
|
119
|
+
const bytesDownloadedInWindow = congestionWindow * TCP_SEGMENT_SIZE;
|
|
120
|
+
totalBytesDownloaded += bytesDownloadedInWindow;
|
|
121
|
+
bytesRemaining -= bytesDownloadedInWindow;
|
|
122
|
+
}
|
|
123
|
+
const timeElapsed = timeElapsedForTTFB + downloadTimeElapsed;
|
|
124
|
+
const extraBytesDownloaded = this._h2 ? Math.max(totalBytesDownloaded - bytesToDownload, 0) : 0;
|
|
125
|
+
const bytesDownloaded = Math.max(Math.min(totalBytesDownloaded, bytesToDownload), 0);
|
|
126
|
+
let connectionTiming;
|
|
127
|
+
if (!this._warmed) {
|
|
128
|
+
connectionTiming = {
|
|
129
|
+
dnsResolutionTime,
|
|
130
|
+
connectionTime: handshakeAndRequest - dnsResolutionTime,
|
|
131
|
+
sslTime: this._ssl ? twoWayLatency : undefined,
|
|
132
|
+
timeToFirstByte,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else if (this._h2) {
|
|
136
|
+
// TODO: timing information currently difficult to model for warm h2 connections.
|
|
137
|
+
connectionTiming = {
|
|
138
|
+
timeToFirstByte,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
connectionTiming = {
|
|
143
|
+
connectionTime: handshakeAndRequest,
|
|
144
|
+
timeToFirstByte,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
roundTrips,
|
|
149
|
+
timeElapsed,
|
|
150
|
+
bytesDownloaded,
|
|
151
|
+
extraBytesDownloaded,
|
|
152
|
+
congestionWindow,
|
|
153
|
+
connectionTiming,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export { TCPConnection };
|
|
158
|
+
//# sourceMappingURL=TCPConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCPConnection.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/TCPConnection.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAmB7B,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,aAAa;IACjB,OAAO,CAAU;IACjB,IAAI,CAAU;IACd,GAAG,CAAU;IACb,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,cAAc,CAAS;IACvB,iBAAiB,CAAS;IAC1B,0BAA0B,CAAS;IAEnC,YAAY,GAAW,EAAE,UAAkB,EAAE,aAAa,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,EAAE,EAAE,GAAG,KAAK;QACpF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,yBAAyB,CAAC;QACnD,IAAI,CAAC,0BAA0B,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,2BAA2B,CAAC,GAAW,EAAE,mBAA2B;QACzE,MAAM,mBAAmB,GAAG,IAAI,GAAG,GAAG,CAAC;QACvC,MAAM,iBAAiB,G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iB;gBACvD,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBAC9C,eAAe;aAChB,CAAC;QACJ,CAAC;aAAM,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACpB,iFAAiF;YACjF,gBAAgB,GAAG;gBACjB,eAAe;aAChB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,gBAAgB,GAAG;gBACjB,cAAc,EAAE,mBAAmB;gBACnC,eAAe;aAChB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,UAAU;YACV,WAAW;YACX,eAAe;YACf,oBAAoB;YACpB,gBAAgB;YAChB,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAC,aAAa,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport {type ConnectionTiming} from './SimulationTimingMap.js';\n\ninterface DownloadOptions {\n dnsResolutionTime?: number;\n timeAlreadyElapsed?: number;\n maximumTimeToElapse?: number;\n}\n\ninterface DownloadResults {\n roundTrips: number;\n timeElapsed: number;\n bytesDownloaded: number;\n extraBytesDownloaded: number;\n congestionWindow: number;\n connectionTiming: ConnectionTiming;\n}\n\nconst INITIAL_CONGESTION_WINDOW = 10;\nconst TCP_SEGMENT_SIZE = 1460;\n\nclass TCPConnection {\n _warmed: boolean;\n _ssl: boolean;\n _h2: boolean;\n _rtt: number;\n _throughput: number;\n _serverLatency: number;\n _congestionWindow: number;\n _h2OverflowBytesDownloaded: number;\n\n constructor(rtt: number, throughput: number, serverLatency = 0, ssl = true, h2 = false) {\n this._warmed = false;\n this._ssl = ssl;\n this._h2 = h2;\n this._rtt = rtt;\n this._throughput = throughput;\n this._serverLatency = serverLatency;\n this._congestionWindow = INITIAL_CONGESTION_WINDOW;\n this._h2OverflowBytesDownloaded = 0;\n }\n\n static maximumSaturatedConnections(rtt: number, availableThroughput: number): number {\n const roundTripsPerSecond = 1000 / rtt;\n const bytesPerRoundTrip = TCP_SEGMENT_SIZE;\n const bytesPerSecond = roundTripsPerSecond * bytesPerRoundTrip;\n const minimumThroughputRequiredPerRequest = bytesPerSecond * 8;\n return Math.floor(availableThroughput / minimumThroughputRequiredPerRequest);\n }\n\n _computeMaximumCongestionWindowInSegments(): number {\n const bytesPerSecond = this._throughput / 8;\n const secondsPerRoundTrip = this._rtt / 1000;\n const bytesPerRoundTrip = bytesPerSecond * secondsPerRoundTrip;\n return Math.floor(bytesPerRoundTrip / TCP_SEGMENT_SIZE);\n }\n\n setThroughput(throughput: number): void {\n this._throughput = throughput;\n }\n\n setCongestionWindow(congestion: number): void {\n this._congestionWindow = congestion;\n }\n\n setWarmed(warmed: boolean): void {\n this._warmed = warmed;\n }\n\n isWarm(): boolean {\n return this._warmed;\n }\n\n isH2(): boolean {\n return this._h2;\n }\n\n get congestionWindow(): number {\n return this._congestionWindow;\n }\n\n /**\n * Sets the number of excess bytes that are available to this connection on future downloads, only\n * applies to H2 connections.\n */\n setH2OverflowBytesDownloaded(bytes: number): void {\n if (!this._h2) {\n return;\n }\n this._h2OverflowBytesDownloaded = bytes;\n }\n\n clone(): TCPConnection {\n return Object.assign(new TCPConnection(this._rtt, this._throughput), this);\n }\n\n /**\n * Simulates a network download of a particular number of bytes over an optional maximum amount of time\n * and returns information about the ending state.\n *\n * See https://hpbn.co/building-blocks-of-tcp/#three-way-handshake and\n * https://hpbn.co/transport-layer-security-tls/#tls-handshake for details.\n */\n simulateDownloadUntil(bytesToDownload: number, options?: DownloadOptions): DownloadResults {\n const {timeAlreadyElapsed = 0, maximumTimeToElapse = Infinity, dnsResolutionTime = 0} = options || {};\n\n if (this._warmed && this._h2) {\n bytesToDownload -= this._h2OverflowBytesDownloaded;\n }\n const twoWayLatency = this._rtt;\n const oneWayLatency = twoWayLatency / 2;\n const maximumCongestionWindow = this._computeMaximumCongestionWindowInSegments();\n\n let handshakeAndRequest = oneWayLatency;\n if (!this._warmed) {\n handshakeAndRequest =\n // DNS lookup\n dnsResolutionTime +\n // SYN\n oneWayLatency +\n // SYN ACK\n oneWayLatency +\n // ACK + initial request\n oneWayLatency +\n // ClientHello/ServerHello assuming TLS False Start is enabled (https://istlsfastyet.com/#server-performance).\n (this._ssl ? twoWayLatency : 0);\n }\n\n let roundTrips = Math.ceil(handshakeAndRequest / twoWayLatency);\n let timeToFirstByte = handshakeAndRequest + this._serverLatency + oneWayLatency;\n if (this._warmed && this._h2) {\n timeToFirstByte = 0;\n }\n\n const timeElapsedForTTFB = Math.max(timeToFirstByte - timeAlreadyElapsed, 0);\n const maximumDownloadTimeToElapse = maximumTimeToElapse - timeElapsedForTTFB;\n\n let congestionWindow = Math.min(this._congestionWindow, maximumCongestionWindow);\n let totalBytesDownloaded = 0;\n if (timeElapsedForTTFB > 0) {\n totalBytesDownloaded = congestionWindow * TCP_SEGMENT_SIZE;\n } else {\n roundTrips = 0;\n }\n\n let downloadTimeElapsed = 0;\n let bytesRemaining = bytesToDownload - totalBytesDownloaded;\n while (bytesRemaining > 0 && downloadTimeElapsed <= maximumDownloadTimeToElapse) {\n roundTrips++;\n downloadTimeElapsed += twoWayLatency;\n congestionWindow = Math.max(Math.min(maximumCongestionWindow, congestionWindow * 2), 1);\n\n const bytesDownloadedInWindow = congestionWindow * TCP_SEGMENT_SIZE;\n totalBytesDownloaded += bytesDownloadedInWindow;\n bytesRemaining -= bytesDownloadedInWindow;\n }\n\n const timeElapsed = timeElapsedForTTFB + downloadTimeElapsed;\n const extraBytesDownloaded = this._h2 ? Math.max(totalBytesDownloaded - bytesToDownload, 0) : 0;\n const bytesDownloaded = Math.max(Math.min(totalBytesDownloaded, bytesToDownload), 0);\n\n let connectionTiming: ConnectionTiming;\n if (!this._warmed) {\n connectionTiming = {\n dnsResolutionTime,\n connectionTime: handshakeAndRequest - dnsResolutionTime,\n sslTime: this._ssl ? twoWayLatency : undefined,\n timeToFirstByte,\n };\n } else if (this._h2) {\n // TODO: timing information currently difficult to model for warm h2 connections.\n connectionTiming = {\n timeToFirstByte,\n };\n } else {\n connectionTiming = {\n connectionTime: handshakeAndRequest,\n timeToFirstByte,\n };\n }\n\n return {\n roundTrips,\n timeElapsed,\n bytesDownloaded,\n extraBytesDownloaded,\n congestionWindow,\n connectionTiming,\n };\n }\n}\n\nexport {TCPConnection};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"compilerOptions":{"composite":true,"outDir":".","baseUrl":".","rootDir":"../../../../../../../../front_end/models/trace/lantern/simulation"},"files":["../../../../../../../../front_end/models/trace/lantern/simulation/simulation.ts"],"references":[{"path":"./simulation-tsconfig.json"}]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"checkJs": true,
|
|
5
|
+
"composite": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"lib": [
|
|
11
|
+
"esnext",
|
|
12
|
+
"dom",
|
|
13
|
+
"dom.iterable"
|
|
14
|
+
],
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"noEmitOnError": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noUnusedLocals": false,
|
|
21
|
+
"outDir": ".",
|
|
22
|
+
"rootDir": "../../../../../../../../front_end/models/trace/lantern/simulation",
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"sourceMap": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext",
|
|
27
|
+
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
28
|
+
"typeRoots": [],
|
|
29
|
+
"useUnknownInCatchVariables": false
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/simulation.ts",
|
|
33
|
+
"../../../../../../../../front_end/legacy/legacy-defs.d.ts",
|
|
34
|
+
"../../../../../../../../front_end/global_typings/global_defs.d.ts",
|
|
35
|
+
"../../../../../../../../node_modules/@types/filesystem/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"references": [
|
|
38
|
+
{
|
|
39
|
+
"path": "./simulation-tsconfig.json"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"checkJs": true,
|
|
5
|
+
"composite": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"lib": [
|
|
11
|
+
"esnext",
|
|
12
|
+
"dom",
|
|
13
|
+
"dom.iterable"
|
|
14
|
+
],
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"noEmitOnError": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noUnusedLocals": false,
|
|
21
|
+
"outDir": ".",
|
|
22
|
+
"rootDir": "../../../../../../../../front_end/models/trace/lantern/simulation",
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"sourceMap": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext",
|
|
27
|
+
"tsBuildInfoFile": "simulation-tsconfig.json.tsbuildinfo",
|
|
28
|
+
"typeRoots": [],
|
|
29
|
+
"useUnknownInCatchVariables": false
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/ConnectionPool.ts",
|
|
33
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/Constants.ts",
|
|
34
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/DNSCache.ts",
|
|
35
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/SimulationTimingMap.ts",
|
|
36
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/Simulator.ts",
|
|
37
|
+
"../../../../../../../../front_end/models/trace/lantern/simulation/TCPConnection.ts",
|
|
38
|
+
"../../../../../../../../front_end/legacy/legacy-defs.d.ts",
|
|
39
|
+
"../../../../../../../../front_end/global_typings/global_defs.d.ts",
|
|
40
|
+
"../../../../../../../../node_modules/@types/filesystem/index.d.ts"
|
|
41
|
+
],
|
|
42
|
+
"references": [
|
|
43
|
+
{
|
|
44
|
+
"path": "../graph/bundle-tsconfig.json"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"path": "../types/bundle-tsconfig.json"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
export * from './ConnectionPool.js';
|
|
5
|
+
export * from './Constants.js';
|
|
6
|
+
export * from './DNSCache.js';
|
|
7
|
+
export * from './SimulationTimingMap.js';
|
|
8
|
+
export * from './Simulator.js';
|
|
9
|
+
export * from './TCPConnection.js';
|
|
10
|
+
//# sourceMappingURL=simulation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/simulation/simulation.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * from './ConnectionPool.js';\nexport * from './Constants.js';\nexport * from './DNSCache.js';\nexport * from './SimulationTimingMap.js';\nexport * from './Simulator.js';\nexport * from './TCPConnection.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"compilerOptions":{"composite":true,"outDir":".","baseUrl":".","rootDir":"../../../../../../../../front_end/models/trace/lantern/types"},"files":["../../../../../../../../front_end/models/trace/lantern/types/types.ts"],"references":[{"path":"./types-tsconfig.json"}]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"checkJs": true,
|
|
5
|
+
"composite": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"lib": [
|
|
11
|
+
"esnext",
|
|
12
|
+
"dom",
|
|
13
|
+
"dom.iterable"
|
|
14
|
+
],
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"noEmitOnError": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noUnusedLocals": false,
|
|
21
|
+
"outDir": ".",
|
|
22
|
+
"rootDir": "../../../../../../../../front_end/models/trace/lantern/types",
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"sourceMap": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext",
|
|
27
|
+
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
28
|
+
"typeRoots": [],
|
|
29
|
+
"useUnknownInCatchVariables": false
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"../../../../../../../../front_end/models/trace/lantern/types/types.ts",
|
|
33
|
+
"../../../../../../../../front_end/legacy/legacy-defs.d.ts",
|
|
34
|
+
"../../../../../../../../front_end/global_typings/global_defs.d.ts",
|
|
35
|
+
"../../../../../../../../node_modules/@types/filesystem/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"references": [
|
|
38
|
+
{
|
|
39
|
+
"path": "./types-tsconfig.json"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type * as Protocol from '../../../../generated/protocol.js';
|
|
2
|
+
export declare const NetworkRequestTypes: {
|
|
3
|
+
readonly XHR: "XHR";
|
|
4
|
+
readonly Fetch: "Fetch";
|
|
5
|
+
readonly EventSource: "EventSource";
|
|
6
|
+
readonly Script: "Script";
|
|
7
|
+
readonly Stylesheet: "Stylesheet";
|
|
8
|
+
readonly Image: "Image";
|
|
9
|
+
readonly Media: "Media";
|
|
10
|
+
readonly Font: "Font";
|
|
11
|
+
readonly Document: "Document";
|
|
12
|
+
readonly TextTrack: "TextTrack";
|
|
13
|
+
readonly WebSocket: "WebSocket";
|
|
14
|
+
readonly Other: "Other";
|
|
15
|
+
readonly Manifest: "Manifest";
|
|
16
|
+
readonly SignedExchange: "SignedExchange";
|
|
17
|
+
readonly Ping: "Ping";
|
|
18
|
+
readonly Preflight: "Preflight";
|
|
19
|
+
readonly CSPViolationReport: "CSPViolationReport";
|
|
20
|
+
readonly Prefetch: "Prefetch";
|
|
21
|
+
};
|
|
22
|
+
export type TraceEvent = {
|
|
23
|
+
name: string;
|
|
24
|
+
args: {
|
|
25
|
+
name?: string;
|
|
26
|
+
data?: {
|
|
27
|
+
frame?: string;
|
|
28
|
+
readyState?: number;
|
|
29
|
+
stackTrace?: {
|
|
30
|
+
url: string;
|
|
31
|
+
}[];
|
|
32
|
+
url?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
pid: number;
|
|
36
|
+
tid: number;
|
|
37
|
+
/** Timestamp of the event in microseconds. */
|
|
38
|
+
ts: number;
|
|
39
|
+
dur: number;
|
|
40
|
+
};
|
|
41
|
+
export type Trace = {
|
|
42
|
+
traceEvents: TraceEvent[];
|
|
43
|
+
};
|
|
44
|
+
export type ResourcePriority = ('VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh');
|
|
45
|
+
export type ResourceType = keyof typeof NetworkRequestTypes;
|
|
46
|
+
type InitiatorType = ('parser' | 'script' | 'preload' | 'SignedExchange' | 'preflight' | 'other');
|
|
47
|
+
export type ResourceTiming = Protocol.Network.ResourceTiming;
|
|
48
|
+
type CallStack = {
|
|
49
|
+
callFrames: Array<{
|
|
50
|
+
scriptId: string;
|
|
51
|
+
url: string;
|
|
52
|
+
lineNumber: number;
|
|
53
|
+
columnNumber: number;
|
|
54
|
+
functionName: string;
|
|
55
|
+
}>;
|
|
56
|
+
parent?: CallStack;
|
|
57
|
+
};
|
|
58
|
+
export type ParsedURL = {
|
|
59
|
+
/**
|
|
60
|
+
* Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)
|
|
61
|
+
*/
|
|
62
|
+
scheme: string;
|
|
63
|
+
/**
|
|
64
|
+
* Equivalent to a `new URL(url).hostname`
|
|
65
|
+
*/
|
|
66
|
+
host: string;
|
|
67
|
+
securityOrigin: string;
|
|
68
|
+
};
|
|
69
|
+
export type AnyNetworkObject = any;
|
|
70
|
+
export type NetworkRequest<T = AnyNetworkObject> = {
|
|
71
|
+
requestId: string;
|
|
72
|
+
connectionId: number;
|
|
73
|
+
connectionReused: boolean;
|
|
74
|
+
url: string;
|
|
75
|
+
protocol: string;
|
|
76
|
+
parsedURL: ParsedURL;
|
|
77
|
+
documentURL: string;
|
|
78
|
+
/** When the renderer process initially discovers a network request, in milliseconds. */
|
|
79
|
+
rendererStartTime: number;
|
|
80
|
+
/**
|
|
81
|
+
* When the network service is about to handle a request, ie. just before going to the
|
|
82
|
+
* HTTP cache or going to the network for DNS/connection setup, in milliseconds.
|
|
83
|
+
*/
|
|
84
|
+
networkRequestTime: number;
|
|
85
|
+
/**
|
|
86
|
+
* When the last byte of the response headers is received, in milliseconds.
|
|
87
|
+
* Equal to networkRequestTime if no data is recieved over the
|
|
88
|
+
* network (ex: cached requests or data urls).
|
|
89
|
+
*/
|
|
90
|
+
responseHeadersEndTime: number;
|
|
91
|
+
/** When the last byte of the response body is received, in milliseconds. */
|
|
92
|
+
networkEndTime: number;
|
|
93
|
+
transferSize: number;
|
|
94
|
+
resourceSize: number;
|
|
95
|
+
fromDiskCache: boolean;
|
|
96
|
+
fromMemoryCache: boolean;
|
|
97
|
+
isLinkPreload: boolean;
|
|
98
|
+
finished: boolean;
|
|
99
|
+
failed: boolean;
|
|
100
|
+
statusCode: number;
|
|
101
|
+
/** The network request that redirected to this one */
|
|
102
|
+
redirectSource: NetworkRequest<T> | undefined;
|
|
103
|
+
/** The network request that this one redirected to */
|
|
104
|
+
redirectDestination: NetworkRequest<T> | undefined;
|
|
105
|
+
initiator: {
|
|
106
|
+
type: InitiatorType;
|
|
107
|
+
url?: string;
|
|
108
|
+
stack?: CallStack;
|
|
109
|
+
};
|
|
110
|
+
initiatorRequest: NetworkRequest<T> | undefined;
|
|
111
|
+
/** The chain of network requests that redirected to this one */
|
|
112
|
+
redirects: NetworkRequest[] | undefined;
|
|
113
|
+
timing: Protocol.Network.ResourceTiming | undefined;
|
|
114
|
+
resourceType: ResourceType | undefined;
|
|
115
|
+
mimeType: string;
|
|
116
|
+
priority: ResourcePriority;
|
|
117
|
+
frameId: string | undefined;
|
|
118
|
+
fromWorker: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Optional value for how long the server took to respond to this request.
|
|
121
|
+
* When not provided, the server response time is derived from the timing object.
|
|
122
|
+
*/
|
|
123
|
+
serverResponseTime?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Implementation-specific canoncial data structure that this Lantern NetworkRequest
|
|
126
|
+
* was derived from.
|
|
127
|
+
* Users of Lantern create a NetworkRequest matching this interface,
|
|
128
|
+
* but can store the source-of-truth for their network model in this property.
|
|
129
|
+
* This is then accessible as a read-only property on NetworkNode.
|
|
130
|
+
*/
|
|
131
|
+
rawRequest?: T;
|
|
132
|
+
};
|
|
133
|
+
export declare namespace Simulation {
|
|
134
|
+
interface URL {
|
|
135
|
+
/** URL of the initially requested URL */
|
|
136
|
+
requestedUrl?: string;
|
|
137
|
+
/** URL of the last document request */
|
|
138
|
+
mainDocumentUrl?: string;
|
|
139
|
+
}
|
|
140
|
+
/** Simulation settings that control the amount of network & cpu throttling in the run. */
|
|
141
|
+
interface ThrottlingSettings {
|
|
142
|
+
/** The round trip time in milliseconds. */
|
|
143
|
+
rttMs?: number;
|
|
144
|
+
/** The network throughput in kilobits per second. */
|
|
145
|
+
throughputKbps?: number;
|
|
146
|
+
/** The network request latency in milliseconds. */
|
|
147
|
+
requestLatencyMs?: number;
|
|
148
|
+
/** The network download throughput in kilobits per second. */
|
|
149
|
+
downloadThroughputKbps?: number;
|
|
150
|
+
/** The network upload throughput in kilobits per second. */
|
|
151
|
+
uploadThroughputKbps?: number;
|
|
152
|
+
/** The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>). */
|
|
153
|
+
cpuSlowdownMultiplier?: number;
|
|
154
|
+
}
|
|
155
|
+
interface PrecomputedLanternData {
|
|
156
|
+
additionalRttByOrigin: {
|
|
157
|
+
[origin: string]: number;
|
|
158
|
+
};
|
|
159
|
+
serverResponseTimeByOrigin: {
|
|
160
|
+
[origin: string]: number;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
interface Settings {
|
|
164
|
+
networkAnalysis: {
|
|
165
|
+
rtt: number;
|
|
166
|
+
additionalRttByOrigin: Map<string, number>;
|
|
167
|
+
serverResponseTimeByOrigin: Map<string, number>;
|
|
168
|
+
throughput: number;
|
|
169
|
+
};
|
|
170
|
+
/** The method used to throttle the network. */
|
|
171
|
+
throttlingMethod: 'devtools' | 'simulate' | 'provided';
|
|
172
|
+
/** The throttling config settings. */
|
|
173
|
+
throttling: Required<ThrottlingSettings>;
|
|
174
|
+
/** Precomputed lantern estimates to use instead of observed analysis. */
|
|
175
|
+
precomputedLanternData?: PrecomputedLanternData | null;
|
|
176
|
+
}
|
|
177
|
+
interface Options {
|
|
178
|
+
rtt?: number;
|
|
179
|
+
throughput?: number;
|
|
180
|
+
observedThroughput: number;
|
|
181
|
+
maximumConcurrentRequests?: number;
|
|
182
|
+
cpuSlowdownMultiplier?: number;
|
|
183
|
+
layoutTaskMultiplier?: number;
|
|
184
|
+
additionalRttByOrigin?: Map<string, number>;
|
|
185
|
+
serverResponseTimeByOrigin?: Map<string, number>;
|
|
186
|
+
}
|
|
187
|
+
interface ProcessedNavigation {
|
|
188
|
+
timestamps: {
|
|
189
|
+
firstContentfulPaint: number;
|
|
190
|
+
largestContentfulPaint?: number;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
interface NodeTiming {
|
|
194
|
+
startTime: number;
|
|
195
|
+
endTime: number;
|
|
196
|
+
duration: number;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
export const NetworkRequestTypes = {
|
|
5
|
+
XHR: 'XHR',
|
|
6
|
+
Fetch: 'Fetch',
|
|
7
|
+
EventSource: 'EventSource',
|
|
8
|
+
Script: 'Script',
|
|
9
|
+
Stylesheet: 'Stylesheet',
|
|
10
|
+
Image: 'Image',
|
|
11
|
+
Media: 'Media',
|
|
12
|
+
Font: 'Font',
|
|
13
|
+
Document: 'Document',
|
|
14
|
+
TextTrack: 'TextTrack',
|
|
15
|
+
WebSocket: 'WebSocket',
|
|
16
|
+
Other: 'Other',
|
|
17
|
+
Manifest: 'Manifest',
|
|
18
|
+
SignedExchange: 'SignedExchange',
|
|
19
|
+
Ping: 'Ping',
|
|
20
|
+
Preflight: 'Preflight',
|
|
21
|
+
CSPViolationReport: 'CSPViolationReport',
|
|
22
|
+
Prefetch: 'Prefetch',
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Lantern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lantern.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,kBAAkB,EAAE,oBAAoB;IACxC,QAAQ,EAAE,UAAU;CACZ,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../../generated/protocol.js';\n\nexport const NetworkRequestTypes = {\n XHR: 'XHR',\n Fetch: 'Fetch',\n EventSource: 'EventSource',\n Script: 'Script',\n Stylesheet: 'Stylesheet',\n Image: 'Image',\n Media: 'Media',\n Font: 'Font',\n Document: 'Document',\n TextTrack: 'TextTrack',\n WebSocket: 'WebSocket',\n Other: 'Other',\n Manifest: 'Manifest',\n SignedExchange: 'SignedExchange',\n Ping: 'Ping',\n Preflight: 'Preflight',\n CSPViolationReport: 'CSPViolationReport',\n Prefetch: 'Prefetch',\n} as const;\n\nexport type TraceEvent = {\n name: string,\n args: {\n name?: string,\n data?: {\n frame?: string,\n readyState?: number,\n stackTrace?: {\n url: string,\n }[],\n url?: string,\n },\n },\n pid: number,\n tid: number,\n /** Timestamp of the event in microseconds. */\n ts: number,\n dur: number,\n};\nexport type Trace = {\n traceEvents: TraceEvent[],\n};\nexport type ResourcePriority = ('VeryLow'|'Low'|'Medium'|'High'|'VeryHigh');\nexport type ResourceType = keyof typeof NetworkRequestTypes;\ntype InitiatorType = ('parser'|'script'|'preload'|'SignedExchange'|'preflight'|'other');\nexport type ResourceTiming = Protocol.Network.ResourceTiming;\ntype CallStack = {\n callFrames: Array<{\n scriptId: string,\n url: string,\n lineNumber: number,\n columnNumber: number,\n functionName: string,\n }>,\n parent?: CallStack,\n};\n\nexport type ParsedURL = {\n /**\n * Equivalent to a `new URL(url).protocol` BUT w/o the trailing colon (:)\n */\n scheme: string,\n /**\n * Equivalent to a `new URL(url).hostname`\n */\n host: string,\n securityOrigin: string,\n};\n\n// When Lantern NetworkRequests are constructed, the source-of-truth of the network record is given as `rawRequest`.\n// Internally Lantern doesn't care about the type of this field, so a default type is given to simplify internal code\n// by avoiding unnecessary typescript overhead.\n// If callers want to access the underlying network record, they are expected to make use of this generic on top-level\n// interfaces like Simulator.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyNetworkObject = any;\n\nexport type NetworkRequest<T = AnyNetworkObject> = {\n requestId: string,\n connectionId: number,\n connectionReused: boolean,\n url: string,\n protocol: string,\n parsedURL: ParsedURL,\n documentURL: string,\n /** When the renderer process initially discovers a network request, in milliseconds. */\n rendererStartTime: number,\n /**\n * When the network service is about to handle a request, ie. just before going to the\n * HTTP cache or going to the network for DNS/connection setup, in milliseconds.\n */\n networkRequestTime: number,\n /**\n * When the last byte of the response headers is received, in milliseconds.\n * Equal to networkRequestTime if no data is recieved over the\n * network (ex: cached requests or data urls).\n */\n responseHeadersEndTime: number,\n /** When the last byte of the response body is received, in milliseconds. */\n networkEndTime: number,\n transferSize: number,\n resourceSize: number,\n fromDiskCache: boolean,\n fromMemoryCache: boolean,\n isLinkPreload: boolean,\n finished: boolean,\n failed: boolean,\n statusCode: number,\n /** The network request that redirected to this one */\n redirectSource: NetworkRequest<T>|undefined,\n /** The network request that this one redirected to */\n redirectDestination: NetworkRequest<T>|undefined,\n // TODO: can't use Protocol.Network.Initiator because of type mismatch in Lighthouse initiator.\n initiator: {\n type: InitiatorType,\n url?: string,\n stack?: CallStack,\n },\n initiatorRequest: NetworkRequest<T>|undefined,\n /** The chain of network requests that redirected to this one */\n redirects: NetworkRequest[]|undefined,\n timing: Protocol.Network.ResourceTiming|undefined,\n resourceType: ResourceType|undefined,\n mimeType: string,\n priority: ResourcePriority,\n frameId: string|undefined,\n fromWorker: boolean,\n /**\n * Optional value for how long the server took to respond to this request.\n * When not provided, the server response time is derived from the timing object.\n */\n serverResponseTime?: number,\n /**\n * Implementation-specific canoncial data structure that this Lantern NetworkRequest\n * was derived from.\n * Users of Lantern create a NetworkRequest matching this interface,\n * but can store the source-of-truth for their network model in this property.\n * This is then accessible as a read-only property on NetworkNode.\n */\n rawRequest?: T,\n};\n\nexport namespace Simulation {\n export interface URL {\n /** URL of the initially requested URL */\n requestedUrl?: string;\n /** URL of the last document request */\n mainDocumentUrl?: string;\n }\n\n /** Simulation settings that control the amount of network & cpu throttling in the run. */\n export interface ThrottlingSettings {\n /** The round trip time in milliseconds. */\n rttMs?: number;\n /** The network throughput in kilobits per second. */\n throughputKbps?: number;\n // devtools settings\n /** The network request latency in milliseconds. */\n requestLatencyMs?: number;\n /** The network download throughput in kilobits per second. */\n downloadThroughputKbps?: number;\n /** The network upload throughput in kilobits per second. */\n uploadThroughputKbps?: number;\n // used by both\n /** The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>). */\n cpuSlowdownMultiplier?: number;\n }\n\n export interface PrecomputedLanternData {\n additionalRttByOrigin: {[origin: string]: number};\n serverResponseTimeByOrigin: {[origin: string]: number};\n }\n\n export interface Settings {\n networkAnalysis: {\n rtt: number,\n additionalRttByOrigin: Map<string, number>,\n serverResponseTimeByOrigin: Map<string, number>,\n throughput: number,\n };\n /** The method used to throttle the network. */\n throttlingMethod: 'devtools'|'simulate'|'provided';\n /** The throttling config settings. */\n throttling: Required<ThrottlingSettings>;\n /** Precomputed lantern estimates to use instead of observed analysis. */\n precomputedLanternData?: PrecomputedLanternData|null;\n }\n\n export interface Options {\n rtt?: number;\n throughput?: number;\n observedThroughput: number;\n maximumConcurrentRequests?: number;\n cpuSlowdownMultiplier?: number;\n layoutTaskMultiplier?: number;\n additionalRttByOrigin?: Map<string, number>;\n serverResponseTimeByOrigin?: Map<string, number>;\n }\n\n export interface ProcessedNavigation {\n timestamps: {\n firstContentfulPaint: number,\n largestContentfulPaint?: number,\n };\n }\n\n export interface NodeTiming {\n startTime: number;\n endTime: number;\n duration: number;\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"checkJs": true,
|
|
5
|
+
"composite": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"lib": [
|
|
11
|
+
"esnext",
|
|
12
|
+
"dom",
|
|
13
|
+
"dom.iterable"
|
|
14
|
+
],
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"noEmitOnError": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noUnusedLocals": false,
|
|
21
|
+
"outDir": ".",
|
|
22
|
+
"rootDir": "../../../../../../../../front_end/models/trace/lantern/types",
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"sourceMap": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext",
|
|
27
|
+
"tsBuildInfoFile": "types-tsconfig.json.tsbuildinfo",
|
|
28
|
+
"typeRoots": [],
|
|
29
|
+
"useUnknownInCatchVariables": false
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"../../../../../../../../front_end/models/trace/lantern/types/Lantern.ts",
|
|
33
|
+
"../../../../../../../../front_end/legacy/legacy-defs.d.ts",
|
|
34
|
+
"../../../../../../../../front_end/global_typings/global_defs.d.ts",
|
|
35
|
+
"../../../../../../../../node_modules/@types/filesystem/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"references": [
|
|
38
|
+
{
|
|
39
|
+
"path": "../../types/bundle-tsconfig.json"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Lantern.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/types/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,cAAc,cAAc,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport * from './Lantern.js';\n"]}
|