From 918b8d57fb9cdbe827c29980ff859f6d1394befa Mon Sep 17 00:00:00 2001 From: Steve Golton Date: Wed, 4 Oct 2023 21:22:02 +0000 Subject: [PATCH] [ui] Fix integration tests. - Fix broken summary tracks when utids are identical. - Refresh after track's onCreate completes to ensure tracks appear. - A few tweaks and comments re track lifecycle. - Fix screenshot test for correctly rendered non finishing slices, which were previously rendered incorrectly (no gradient) until the window moves. Change-Id: I9d395ea5d9ff63e1519177517f216004c011de6e --- .../ui-android_trace_30s_load.png.sha256 | 2 +- ui/src/common/state.ts | 3 ++- ui/src/controller/track_decider.ts | 2 +- ui/src/frontend/track_panel.ts | 10 +++++++--- ui/src/tracks/process_summary/index.ts | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/data/ui-screenshots/ui-android_trace_30s_load.png.sha256 b/test/data/ui-screenshots/ui-android_trace_30s_load.png.sha256 index 05dac0552a..6cee1b240b 100644 --- a/test/data/ui-screenshots/ui-android_trace_30s_load.png.sha256 +++ b/test/data/ui-screenshots/ui-android_trace_30s_load.png.sha256 @@ -1 +1 @@ -b301d6515efaffb58f8e8227ae5bcf6b78ea592b92f9037c2abe1954c6102b8e \ No newline at end of file +ec0a00856b147b2e13d0fe18666a307eb085ac437d67f78787131d4ea4190581 \ No newline at end of file diff --git a/ui/src/common/state.ts b/ui/src/common/state.ts index 6ba85475a0..1a8c68e50f 100644 --- a/ui/src/common/state.ts +++ b/ui/src/common/state.ts @@ -122,7 +122,8 @@ export const MAX_TIME = 180; // 39. Ported cpu_slice, ftrace, and android_log tracks to plugin tracks. Track // state entries now require a URI and old track implementations are no // longer registered. -export const STATE_VERSION = 39; +// 40. Ported counter, process summary/sched, & cpu_freq to plugin tracks. +export const STATE_VERSION = 40; export const SCROLLING_TRACK_GROUP = 'ScrollingTracks'; diff --git a/ui/src/controller/track_decider.ts b/ui/src/controller/track_decider.ts index 4be0a24570..b4a82287ff 100644 --- a/ui/src/controller/track_decider.ts +++ b/ui/src/controller/track_decider.ts @@ -1677,7 +1677,7 @@ class TrackDecider { pUuid = this.getOrCreateUuid(utid, upid); const summaryTrackId = uuidv4(); const type = hasSched ? 'schedule' : 'summary'; - const uri = `perfetto.ProcessScheduling#${utid}.${type}`; + const uri = `perfetto.ProcessScheduling#${upid}.${utid}.${type}`; this.tracksToAdd.push({ id: summaryTrackId, diff --git a/ui/src/frontend/track_panel.ts b/ui/src/frontend/track_panel.ts index 64cfd63be8..2586f319c9 100644 --- a/ui/src/frontend/track_panel.ts +++ b/ui/src/frontend/track_panel.ts @@ -365,14 +365,18 @@ export class TrackLifecycleContainer implements Disposable { private state = TrackLifecycleState.Initializing; constructor(private track: TrackLike) { - track.onCreate().then(() => { + track.onCreate().finally(() => { if (this.state === TrackLifecycleState.DestroyPending) { - track.onDestroy(); + track.onDestroy().finally(() => { + this.state = TrackLifecycleState.Destroyed; + }); this.state = TrackLifecycleState.Destroying; } else { this.state = TrackLifecycleState.Initialized; + raf.scheduleFullRedraw(); } }); + // TODO(stevegolton): Handle failure case. } onFullRedraw(): void { @@ -450,7 +454,7 @@ export class TrackLifecycleContainer implements Disposable { break; case TrackLifecycleState.Initialized: this.state = TrackLifecycleState.Destroying; - this.track.onDestroy().then(() => { + this.track.onDestroy().finally(() => { this.state = TrackLifecycleState.Destroyed; }); break; diff --git a/ui/src/tracks/process_summary/index.ts b/ui/src/tracks/process_summary/index.ts index 4e46456c9f..154ead0085 100644 --- a/ui/src/tracks/process_summary/index.ts +++ b/ui/src/tracks/process_summary/index.ts @@ -208,7 +208,7 @@ class ProcessSummaryPlugin implements Plugin { pUuid = this.getOrCreateUuid(utid, upid); const pidForColor = pid || tid || upid || utid || 0; const type = hasSched ? 'schedule' : 'summary'; - const uri = `perfetto.ProcessScheduling#${utid}.${type}`; + const uri = `perfetto.ProcessScheduling#${upid}.${utid}.${type}`; if (hasSched) { const config: ProcessSchedulingTrackConfig = {