From 7137432281d9d60b6cce67b79287ded0d8424a25 Mon Sep 17 00:00:00 2001 From: Alec Miller Date: Sun, 17 Mar 2024 19:28:24 -0700 Subject: [PATCH] kram-profile - one more stab at fixing total --- .../kram-profile/kram_profileApp.swift | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kram-profile/kram-profile/kram_profileApp.swift b/kram-profile/kram-profile/kram_profileApp.swift index 43e72a1..5993739 100644 --- a/kram-profile/kram-profile/kram_profileApp.swift +++ b/kram-profile/kram-profile/kram_profileApp.swift @@ -1484,16 +1484,22 @@ func convertStatsToTotalTrack(_ stats: BuildStats) -> [CatapultEvent] { event.ts = stats.frontendStart + stats.totalSource totalEvents.append(event) - // put this first, or else InstantiateClass isn't ordered properly - // Perfetto must not be sorting the events properly. So order this one first - event = makeDurEvent(tid, "Total CodeGen Function", stats.totalCodeGenFunction, total) - event.ts = stats.frontendStart + stats.totalSource + stats.totalInstantiateFunction - totalEvents.append(event) + // This is nearly always bigger than its parent total 14% vs. 16%, so are totals wrong + var totalInstantiateClass = stats.totalInstantiateClass + if totalInstantiateClass > stats.totalInstantiateFunction { + totalInstantiateClass = stats.totalInstantiateFunction + } - event = makeDurEvent(tid, "Total InstantiateClass", stats.totalInstantiateClass, total) + // This overlaps with some Source, and some InstantiateFunction, so it's sort of double + // counted, so clamp it for now so Perfetto doesn't freak out and get the event order wrong. + event = makeDurEvent(tid, "Total InstantiateClass", totalInstantiateClass, total) event.ts = stats.frontendStart + stats.totalSource totalEvents.append(event) + event = makeDurEvent(tid, "Total CodeGen Function", stats.totalCodeGenFunction, total) + event.ts = stats.frontendStart + stats.totalSource + stats.totalInstantiateFunction + totalEvents.append(event) + // backend event = makeDurEvent(tid, "Total Backend", stats.totalBackend, total) event.ts = stats.backendStart