Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ class FullTraceJankMetricHandler implements MetricHandler {
*/
public match(metricKey: string): FullTraceMetricData | undefined {
const matcher =
/perfetto_ft_(?<process>.*)-missed_(?<jankType>frames|sf_frames|app_frames)/;
/perfetto_ft_(?<process>.*)-(?<jps>weighted_)?missed_(?<jankType>frames|sf_frames|app_frames)/;
const match = matcher.exec(metricKey);
if (!match?.groups) {
return undefined;
}
const metricData: FullTraceMetricData = {
return {
process: expandProcessName(match.groups.process),
jankType: match.groups.jankType as JankType,
isWeighted: !!match.groups.jps,
};
return metricData;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,31 @@ const validMetricsTest: {
expectedOutput: {
process: 'com.google.android.apps.nexuslauncher',
jankType: 'app_frames',
isWeighted: false,
},
},
{
inputMetric: 'perfetto_ft_systemui-missed_sf_frames-mean',
expectedOutput: {
process: 'com.android.systemui',
jankType: 'sf_frames',
isWeighted: false,
},
},
{
inputMetric: 'perfetto_ft_systemui-missed_app_frames-mean',
expectedOutput: {
process: 'com.android.systemui',
jankType: 'app_frames',
isWeighted: false,
},
},
{
inputMetric: 'perfetto_ft_systemui-weighted_missed_app_frames-mean',
expectedOutput: {
process: 'com.android.systemui',
jankType: 'app_frames',
isWeighted: true,
},
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface FullTraceMetricData {

/** Jank type (e.g., app or sf missed frame) */
jankType: JankType;

/** Whether the metric is weighted */
isWeighted: boolean;
}

/**
Expand All @@ -39,6 +42,9 @@ export interface CujScopedMetricData {

/** Jank type (e.g., app or sf missed frame) */
jankType: JankType;

/** Whether the metric is weighted */
isWeighted: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class PinCujMetricHandler implements MetricHandler {
* @returns {CujMetricData | undefined} Parsed data or undefined if no match.
*/
public match(metricKey: string): CujMetricData | undefined {
const matcher = /perfetto_cuj_(?<process>.*)-(?<cujName>.*)-.*-missed_.*/;
const matcher =
/perfetto_cuj_(?<process>.*)-(?<cujName>.*)-.*-(?:weighted_)?missed_.*/;
const match = matcher.exec(metricKey);
if (!match?.groups) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ class PinCujScopedJank implements MetricHandler {
*/
public match(metricKey: string): CujScopedMetricData | undefined {
const matcher =
/perfetto_cuj_(?<process>.*)-(?<cujName>.*)-.*-missed_(?<jankType>frames|sf_frames|app_frames)/;
/perfetto_cuj_(?<process>.*)-(?<cujName>.*)-.*-(?<jps>weighted_)?missed_(?<jankType>frames|sf_frames|app_frames)/;
const match = matcher.exec(metricKey);
if (!match?.groups) {
return undefined;
}
const metricData: CujScopedMetricData = {
return {
process: expandProcessName(match.groups.process),
cujName: match.groups.cujName,
jankType: match.groups.jankType as JankType,
isWeighted: !!match.groups.jps,
};
return metricData;
1;
}

/**
Expand Down Expand Up @@ -83,6 +82,10 @@ class PinCujScopedJank implements MetricHandler {
jankTypeFilter = ' AND sf_missed > 0';
jankTypeDisplayName = 'sf';
}
if (metricData.isWeighted) {
jankTypeFilter += ' AND jank_score > 0';
}

const cuj = metricData.cujName;
const processName = metricData.process;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const validMetricsTest: {
process: 'com.android.systemui',
cujName: 'NOTIFICATION_SHADE_EXPAND_COLLAPSE::Expand',
jankType: 'app_frames',
isWeighted: false,
},
},
{
Expand All @@ -35,6 +36,7 @@ const validMetricsTest: {
process: 'com.android.systemui',
cujName: 'SHADE_DIALOG_OPEN::internet',
jankType: 'sf_frames',
isWeighted: false,
},
},
{
Expand All @@ -44,6 +46,17 @@ const validMetricsTest: {
process: 'com.google.android.apps.nexuslauncher',
cujName: 'RECENTS_SCROLLING',
jankType: 'sf_frames',
isWeighted: false,
},
},
{
inputMetric:
'perfetto_cuj_launcher-RECENTS_SCROLLING-trace_metrics-weighted_missed_sf_frames-mean',
expectedOutput: {
process: 'com.google.android.apps.nexuslauncher',
cujName: 'RECENTS_SCROLLING',
jankType: 'sf_frames',
isWeighted: true,
},
},
];
Expand Down
Loading