Skip to content

Conversation

@haipingyang71
Copy link

@haipingyang71 haipingyang71 commented Apr 3, 2025

Change-Id: Ieb1ccae6e8a5763f6a08839e168a0166e37ec480

Bug: 376308737

Test: ui/run-dev-server with ptraces

UI snapshot: https://screenshot.googleplex.com/6Fqk5FHFtDJKnwb

Change-Id: Ieb1ccae6e8a5763f6a08839e168a0166e37ec480
let slice_glob = `'OpenDexFilesFromOat*'`;
let result = await trace.engine.query(
`
SELECT RUN_METRIC('android/startup/slow_start_thresholds.sql');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using RUN_METRIC in plugins is not allowed. There should be a presubmit check warning you about this if you did tools/install-build-deps. Please port all relevant things you need to the standard library first before trying to use them here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies here and for all other usages of RUN_METRIC in this class.

Copy link
Member

@LalitMaganti LalitMaganti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes as above.

* @returns a track node with the slow start status.
* `undefined` if there are no app startups detected.
*/
export async function slowInsightsTrack(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you already have the data already available in a table/view, you should just create the track directly from that by crafting the correct SQL query instead of pulling it all out and injecting it back in again.

I.e.

const track = await createQuerySliceTrack({
    trace: trace,
    uri: uri,
    data: {
      sqlSource: `
        SELECT
          startup_id AS id,
          ts,
          ts_end - ts as dur
        FROM android_startups
      `,
      columns: ['ts', 'dur', 'name'],
    },
  });

You only need to inject the data if you don't have it available in trace processor already.

const startups: Array<Startup> = [];

// Find app startups
let result = await trace.engine.query(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most if not all of these lets can be consts. Eslint should complain if lets are not reassigned.

Our presubmit checks are still up in the air since the move to github, but you should be able to run eslint with ui/format-sources.

): Promise<TrackNode | undefined> {
// The log tag
let tag = 'Broadcast received';
let slice_glob = `'broadcastReceiveReg*'`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables should be in snakeCase. There's quite a few instances of this here.

return getSlowReasonTrack(trace, slices, uri, title);
}

async function getBindApplicationTrack(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general there's a lot of duplicated code in this file that makes it very difficult to understand exactly what you're trying to do. Could you remove some of this duplication please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants