1
0
mirror of https://github.com/niespodd/browser-fingerprinting.git synced 2021-11-01 22:44:07 +03:00

startTime & endTime for perf vis

This commit is contained in:
niespodd
2021-06-11 04:16:04 +02:00
parent 79f0fef469
commit 9c21cd81e8
3 changed files with 9 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,7 @@
break-inside: avoid;
}
</style>
<script type="module" crossorigin src="assets/index.e17f1f40.js"></script>
<script type="module" crossorigin src="assets/index.feb49b7d.js"></script>
<link rel="modulepreload" href="assets/vendor.0d07671f.js">
<link rel="stylesheet" href="assets/index.f44316bf.css">
</head>

View File

@@ -16,6 +16,7 @@ const TIMING_COLOR = {
const TimelineVisualisation = ({ data }) => {
const timelineWrapper = React.useRef(undefined);
const [svgDimensions, setSvgDimensions] = React.useState(undefined);
const [timings, setTimings] = React.useState({undefined});
React.useEffect(() => {
if (!timelineWrapper.current) return;
@@ -30,6 +31,11 @@ const TimelineVisualisation = ({ data }) => {
const maxW = Math.max(...data.map((d) => d.startTime + d.duration));
const W = maxW - minW;
setTimings({
startTime: minW,
endTime: maxW,
});
return data.map((e) => {
return {
x: ((e.startTime - minW)/W) * width,
@@ -42,6 +48,7 @@ const TimelineVisualisation = ({ data }) => {
return (
<div ref={timelineWrapper} style={{ marginTop: '8px' }}>
<Text mb={2}>Start time <Code>{timings.startTime}</Code>, end time <Code>{timings.endTime}</Code></Text>
{svgDimensions && normalizedData && (
<svg {...svgDimensions}>
<Group>