rename to walltime
This commit is contained in:
parent
932095ccad
commit
59e750bc88
|
|
@ -137,7 +137,7 @@ export class Snapshotter {
|
||||||
html: data.html,
|
html: data.html,
|
||||||
viewport: data.viewport,
|
viewport: data.viewport,
|
||||||
timestamp: monotonicTime(),
|
timestamp: monotonicTime(),
|
||||||
absoluteTimestamp: data.absoluteTimestamp,
|
wallTime: data.wallTime,
|
||||||
collectionTime: data.collectionTime,
|
collectionTime: data.collectionTime,
|
||||||
resourceOverrides: [],
|
resourceOverrides: [],
|
||||||
isMainFrame: page.mainFrame() === frame
|
isMainFrame: page.mainFrame() === frame
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export type SnapshotData = {
|
||||||
}[],
|
}[],
|
||||||
viewport: { width: number, height: number },
|
viewport: { width: number, height: number },
|
||||||
url: string,
|
url: string,
|
||||||
absoluteTimestamp: number, // milliseconds since epoch
|
wallTime: number,
|
||||||
collectionTime: number,
|
collectionTime: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -572,7 +572,7 @@ export function frameSnapshotStreamer(snapshotStreamer: string, removeNoScript:
|
||||||
height: window.innerHeight,
|
height: window.innerHeight,
|
||||||
},
|
},
|
||||||
url: location.href,
|
url: location.href,
|
||||||
absoluteTimestamp: Date.now(),
|
wallTime: Date.now(),
|
||||||
collectionTime: 0,
|
collectionTime: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export class SnapshotServer {
|
||||||
viewport: snapshot.viewport(),
|
viewport: snapshot.viewport(),
|
||||||
url: snapshot.snapshot().frameUrl,
|
url: snapshot.snapshot().frameUrl,
|
||||||
timestamp: snapshot.snapshot().timestamp,
|
timestamp: snapshot.snapshot().timestamp,
|
||||||
absoluteTimestamp: snapshot.snapshot().absoluteTimestamp,
|
wallTime: snapshot.snapshot().wallTime,
|
||||||
} : {
|
} : {
|
||||||
error: 'No snapshot found'
|
error: 'No snapshot found'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,10 @@ export class TraceModernizer {
|
||||||
result.push({ ...event, monotonicTime: 0, origin: 'library' });
|
result.push({ ...event, monotonicTime: 0, origin: 'library' });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (event.type === 'frame-snapshot') {
|
||||||
|
result.push({ ...event, snapshot: { ...event.snapshot, wallTime: 0 } });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Take wall and monotonic time from the first event.
|
// Take wall and monotonic time from the first event.
|
||||||
if (!this._contextEntry.wallTime && event.type === 'before')
|
if (!this._contextEntry.wallTime && event.type === 'before')
|
||||||
this._contextEntry.wallTime = event.wallTime;
|
this._contextEntry.wallTime = event.wallTime;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ export const SnapshotTab: React.FunctionComponent<{
|
||||||
|
|
||||||
const iframeRef0 = React.useRef<HTMLIFrameElement>(null);
|
const iframeRef0 = React.useRef<HTMLIFrameElement>(null);
|
||||||
const iframeRef1 = React.useRef<HTMLIFrameElement>(null);
|
const iframeRef1 = React.useRef<HTMLIFrameElement>(null);
|
||||||
const [snapshotInfo, setSnapshotInfo] = React.useState<{ viewport: typeof kDefaultViewport, url: string, timestamp?: number, absoluteTimestamp?: undefined }>({ viewport: kDefaultViewport, url: '' });
|
const [snapshotInfo, setSnapshotInfo] = React.useState<{ viewport: typeof kDefaultViewport, url: string, timestamp?: number, wallTime?: undefined }>({ viewport: kDefaultViewport, url: '' });
|
||||||
const loadingRef = React.useRef({ iteration: 0, visibleIframe: 0 });
|
const loadingRef = React.useRef({ iteration: 0, visibleIframe: 0 });
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
|
@ -110,7 +110,7 @@ export const SnapshotTab: React.FunctionComponent<{
|
||||||
const newVisibleIframe = 1 - loadingRef.current.visibleIframe;
|
const newVisibleIframe = 1 - loadingRef.current.visibleIframe;
|
||||||
loadingRef.current.iteration = thisIteration;
|
loadingRef.current.iteration = thisIteration;
|
||||||
|
|
||||||
const newSnapshotInfo = { url: '', viewport: kDefaultViewport, timestamp: undefined, absoluteTimestamp: undefined };
|
const newSnapshotInfo = { url: '', viewport: kDefaultViewport, timestamp: undefined, wallTime: undefined };
|
||||||
if (snapshotInfoUrl) {
|
if (snapshotInfoUrl) {
|
||||||
const response = await fetch(snapshotInfoUrl);
|
const response = await fetch(snapshotInfoUrl);
|
||||||
const info = await response.json();
|
const info = await response.json();
|
||||||
|
|
@ -118,7 +118,7 @@ export const SnapshotTab: React.FunctionComponent<{
|
||||||
newSnapshotInfo.url = info.url;
|
newSnapshotInfo.url = info.url;
|
||||||
newSnapshotInfo.viewport = info.viewport;
|
newSnapshotInfo.viewport = info.viewport;
|
||||||
newSnapshotInfo.timestamp = info.timestamp;
|
newSnapshotInfo.timestamp = info.timestamp;
|
||||||
newSnapshotInfo.absoluteTimestamp = info.absoluteTimestamp;
|
newSnapshotInfo.wallTime = info.wallTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -170,13 +170,13 @@ export const SnapshotTab: React.FunctionComponent<{
|
||||||
const page = action ? pageForAction(action) : undefined;
|
const page = action ? pageForAction(action) : undefined;
|
||||||
const screencastFrame = React.useMemo(
|
const screencastFrame = React.useMemo(
|
||||||
() => {
|
() => {
|
||||||
if (snapshotInfo.absoluteTimestamp && page?.screencastFrames[0]?.frameSwapTimestamp)
|
if (snapshotInfo.wallTime && page?.screencastFrames[0]?.frameSwapTimestamp)
|
||||||
return findClosest(page.screencastFrames, frame => frame.frameSwapTimestamp!, snapshotInfo.absoluteTimestamp);
|
return findClosest(page.screencastFrames, frame => frame.frameSwapTimestamp!, snapshotInfo.wallTime);
|
||||||
|
|
||||||
if (snapshotInfo.timestamp && page?.screencastFrames)
|
if (snapshotInfo.timestamp && page?.screencastFrames)
|
||||||
return findClosest(page.screencastFrames, frame => frame.timestamp, snapshotInfo.timestamp);
|
return findClosest(page.screencastFrames, frame => frame.timestamp, snapshotInfo.timestamp);
|
||||||
},
|
},
|
||||||
[page?.screencastFrames, snapshotInfo.timestamp, snapshotInfo.absoluteTimestamp]
|
[page?.screencastFrames, snapshotInfo.timestamp, snapshotInfo.wallTime]
|
||||||
);
|
);
|
||||||
|
|
||||||
return <div
|
return <div
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export type FrameSnapshot = {
|
||||||
frameId: string,
|
frameId: string,
|
||||||
frameUrl: string,
|
frameUrl: string,
|
||||||
timestamp: number,
|
timestamp: number,
|
||||||
absoluteTimestamp: number,
|
wallTime: number,
|
||||||
collectionTime: number,
|
collectionTime: number,
|
||||||
doctype?: string,
|
doctype?: string,
|
||||||
html: NodeSnapshot,
|
html: NodeSnapshot,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue