fix: ensure summary stats reflect inclusive usage in targeted mode
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user