From 34aac2da62b5b5bbd33f400a3243e0dea26dc7dc Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Mon, 23 Feb 2026 18:33:43 +0100 Subject: [PATCH] fix: ensure summary stats reflect inclusive usage in targeted mode --- src/App.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 1b88dcb..3fdac9d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -470,10 +470,17 @@ function ReportView({ report, onBack }: { report: ProfilingReport, onBack: () => }, [report, hideProfiler]); const summaryStats = useMemo(() => { + if (report.mode === ProfilingMode.Targeted) { + // In targeted mode, the root of sortedProcesses is our target + const root = sortedProcesses[0]; + if (root) { + return { cpu: root.inclusive_avg_cpu, mem: root.inclusive_avg_memory_mb }; + } + } const totalCpu = sortedProcesses.reduce((acc, p) => acc + p.avg_cpu, 0); const totalMem = sortedProcesses.reduce((acc, p) => acc + p.avg_memory_mb, 0); return { cpu: totalCpu, mem: totalMem }; - }, [sortedProcesses]); + }, [sortedProcesses, report.mode]); const saveReport = async () => { try {