- {task.scripts.map((script, index) => (
-
- ))}
+
+
Scripts:
+
+ {task.scripts.map((script, index) => (
+
+ ))}
+
>
) : null}
@@ -165,6 +168,8 @@ function LongTaskRow({
);
}
+
+
function TaskTitle({
entry,
}: {
@@ -172,20 +177,42 @@ function TaskTitle({
name: string;
duration: number;
blockingDuration?: number;
+ scripts: LongAnimationTask['scripts'];
};
}) {
const isBlocking =
entry.blockingDuration !== undefined && entry.blockingDuration > 0;
+
+ const scriptTitles = entry.scripts.map(script =>
+ script.invokerType ? script.invokerType : script.name
+ );
+
+ let scriptsDisplay;
+ if (scriptTitles.length === 0) {
+ scriptsDisplay =
No Scripts;
+ } else if (scriptTitles.length === 1) {
+ scriptsDisplay =
{scriptTitles[0]};
+ } else if (scriptTitles.length === 2) {
+ scriptsDisplay =
{scriptTitles[0]}, {scriptTitles[1]};
+ } else {
+ scriptsDisplay = (
+
+ {scriptTitles[0]}, {scriptTitles[1]} {' '}
+ +{scriptTitles.length - 2} More
+
+ );
+ }
+
return (
-
-
Long Animation Frame
-
- ({entry.duration.toFixed(2)} ms)
+
+ {scriptsDisplay}
+
+ {Math.round(entry.duration)} ms
{isBlocking ? (
-
- {entry.blockingDuration!.toFixed(2)} ms blocking
-
+
+ {Math.round(entry.blockingDuration!)} ms blocking
+
) : null}
);
diff --git a/frontend/app/components/shared/DevTools/LongTaskPanel/Script.tsx b/frontend/app/components/shared/DevTools/LongTaskPanel/Script.tsx
index dd006e23f..fc7b3e4af 100644
--- a/frontend/app/components/shared/DevTools/LongTaskPanel/Script.tsx
+++ b/frontend/app/components/shared/DevTools/LongTaskPanel/Script.tsx
@@ -1,5 +1,7 @@
import React from 'react'
import { LongAnimationTask } from './type'
+import { Tag } from 'antd';
+import { Code } from 'lucide-react';
function getAddress(script: LongAnimationTask['scripts'][number]) {
return `${script.sourceURL}${script.sourceFunctionName ? ':' + script.sourceFunctionName : ''}${script.sourceCharPosition && script.sourceCharPosition >= 0 ? ':' + script.sourceCharPosition : ''}`;
@@ -10,7 +12,7 @@ function ScriptTitle({
script: LongAnimationTask['scripts'][number]
}) {
return script.invokerType ? (
- {script.invokerType}
+ {script.invokerType}
) : (
{script.name}
)
@@ -23,13 +25,13 @@ function ScriptInfo({
}) {
const hasInvoker = script.invoker !== script.sourceURL;
return (
-
+
{hasInvoker ? (
) : null}
-
-
+
+
);
}
@@ -42,17 +44,17 @@ function InfoEntry({
value: string | number;
}) {
return (
-
-
{title}
-
{value}
+
);
}
function Script({ script }: { script: LongAnimationTask['scripts'][number] }) {
return (
-
-
+
+
)
diff --git a/frontend/app/components/shared/DevTools/LongTaskPanel/TaskTimeline.tsx b/frontend/app/components/shared/DevTools/LongTaskPanel/TaskTimeline.tsx
index cc5232c3f..64a3f4b0d 100644
--- a/frontend/app/components/shared/DevTools/LongTaskPanel/TaskTimeline.tsx
+++ b/frontend/app/components/shared/DevTools/LongTaskPanel/TaskTimeline.tsx
@@ -3,6 +3,12 @@ import { Tooltip } from 'antd'
import { LongAnimationTask } from "./type";
import cn from "classnames";
+export const getSeverityBgClass = (duration: number) => {
+ if (duration > 200) return 'bg-[#CC0000]';
+ if (duration > 100) return 'bg-[#EFB100]';
+ return 'bg-[#66a299]';
+};
+
function TaskTimeline({ task }: { task: LongAnimationTask }) {
const totalDuration = task.duration;
const scriptDuration = task.scripts.reduce((sum, script) => sum + script.duration, 0);
@@ -16,41 +22,34 @@ function TaskTimeline({ task }: { task: LongAnimationTask }) {
const layoutWidth = (layoutDuration / totalDuration) * 100;
const idleWidth = (idleDuration / totalDuration) * 100;
- const getSeverityClass = (duration) => {
- if (duration > 200) return 'bg-[#e7000b]';
- if (duration > 100) return 'bg-[#efb100]';
- return 'bg-[#51a2ff]';
- };
-
return (
-
-
Timeline:
-
+
+
{scriptDuration > 0 && (
)}
{idleDuration > 0 && (
)}
{layoutDuration > 0 && (
)}
- start: {task.startTime.toFixed(2)}ms
- finish: {(task.startTime + task.duration).toFixed(2)}ms
+ Start: {Math.round(task.startTime)} ms
+ Finish: {Math.round(task.startTime + task.duration)} ms
);