perfetto-ui: Add vsync track
Change-Id: If5ee80f2c443d2a145dd289a67dd9d3596076245
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index e68d26c..565a2c6 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -188,6 +188,26 @@
const engine = assertExists<Engine>(this.engine);
const addToTrackActions: DeferredAction[] = [];
const numCpus = await engine.getNumberOfCpus();
+
+ // TODO(hjd): Move this code out of TraceController.
+ for (const counterName of ['VSYNC-sf', 'VSYNC-app']) {
+ const hasVsync =
+ !!(await engine.query(
+ `select ts from counters where name like "${
+ counterName
+ }" limit 1`))
+ .numRecords;
+ if (!hasVsync) continue;
+ addToTrackActions.push(Actions.addTrack({
+ engineId: this.engineId,
+ kind: 'VsyncTrack',
+ name: `${counterName}`,
+ config: {
+ counterName,
+ }
+ }));
+ }
+
for (let cpu = 0; cpu < numCpus; cpu++) {
addToTrackActions.push(Actions.addTrack({
engineId: this.engineId,