perfetto-ui: Add async search
Bug: 123333520
Bug: 111169965
Change-Id: I354b1b169c183a7239b97e0974c378c4ae5e86f6
diff --git a/ui/src/controller/search_controller.ts b/ui/src/controller/search_controller.ts
index bcc5eac..00833f8 100644
--- a/ui/src/controller/search_controller.ts
+++ b/ui/src/controller/search_controller.ts
@@ -174,6 +174,7 @@
// easier once the track table has entries for all the tracks.
const cpuToTrackId = new Map();
const utidToTrackId = new Map();
+ const engineTrackIdToTrackId = new Map();
for (const track of Object.values(this.app.state.tracks)) {
if (track.kind === 'ChromeSliceTrack') {
utidToTrackId.set((track.config as {utid: number}).utid, track.id);
@@ -183,6 +184,11 @@
cpuToTrackId.set((track.config as {cpu: number}).cpu, track.id);
continue;
}
+ if (track.kind === 'AsyncSliceTrack') {
+ engineTrackIdToTrackId.set(
+ (track.config as {trackId: number}).trackId, track.id);
+ continue;
+ }
}
const rawUtidResult = await this.query(`select utid from thread join process
@@ -204,8 +210,10 @@
ts,
ref_type,
ref,
- ref as utid
- from internal_slice where ref_type = 'utid' and name like '%${search}%'
+ 0 as utid
+ from internal_slice
+ where (ref_type = 'utid' or ref_type == 'track')
+ and name like '%${search}%'
order by ts`);
const numRows = +rawResult.numRecords;
@@ -228,6 +236,8 @@
trackId = cpuToTrackId.get(ref);
} else if (refType === 'utid') {
trackId = utidToTrackId.get(ref);
+ } else if (refType === 'track') {
+ trackId = engineTrackIdToTrackId.get(ref);
}
if (trackId === undefined) {
diff --git a/ui/src/frontend/frontend_local_state.ts b/ui/src/frontend/frontend_local_state.ts
index 8a1a6ed..b0ad921 100644
--- a/ui/src/frontend/frontend_local_state.ts
+++ b/ui/src/frontend/frontend_local_state.ts
@@ -160,6 +160,7 @@
setSearchIndex(index: number) {
this.searchIndex = index;
+ globals.rafScheduler.scheduleRedraw();
}
toggleSidebar() {
diff --git a/ui/src/frontend/search_handler.ts b/ui/src/frontend/search_handler.ts
index 4c64440..20ac144 100644
--- a/ui/src/frontend/search_handler.ts
+++ b/ui/src/frontend/search_handler.ts
@@ -106,8 +106,7 @@
utid: globals.currentSearchResults.utids[index],
id: currentId,
}));
- }
- if (refType === 'utid') {
+ } else {
globals.dispatch(Actions.selectChromeSlice({
id: currentId,
}));