Skip to content

Commit

Permalink
Merge changes from topics "wattson_cleanup_0", "wattson_plugin_on_by_…
Browse files Browse the repository at this point in the history
…default" into main

* changes:
  ui: Enable Wattson plugin by default
  ui: Load Wattson on track expansion
  ui: Reorder Wattson aggregation
  ui: Add includes for Wattson aggregation
  ui: Simplify Wattson track logic
  • Loading branch information
Samuel Wu authored and Gerrit Code Review committed Nov 22, 2024
2 parents 79e0840 + a73c5e5 commit 56a2514
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
526c3bce9a8622bc5ac983a88bec6fb41194c7f84dd7b740468bd275be13ee8e
368ccbd5d12aec6d23c124d43226f4bf352d985d5c930626cb55fc1f3ad516d0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
67240fa5e871e2e8cb9369c06a27dad3a3754bc4628d8d6060ffd6711ab3a012
77289aa186056fc1e61fe081e102d3edd6b02d0ba47d11942bb7c966fb8b5c9a
1 change: 1 addition & 0 deletions ui/src/core/default_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const defaultPlugins = [
'org.chromium.CriticalUserInteraction',
'org.kernel.LinuxKernelSubsystems',
'org.kernel.SuspendResumeLatency',
'org.kernel.Wattson',
'perfetto.CoreCommands',
'perfetto.ExampleTraces',
'perfetto.GlobalGroups',
Expand Down
30 changes: 11 additions & 19 deletions ui/src/plugins/org.kernel.Wattson/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ export default class implements PerfettoPlugin {
// Short circuit if Wattson is not supported for this Perfetto trace
if (!(await hasWattsonSupport(ctx.engine))) return;

ctx.engine.query(`INCLUDE PERFETTO MODULE wattson.curves.estimates;`);

const group = new TrackNode({title: 'Wattson', isSummary: true});
ctx.workspace.addChildInOrder(group);

// CPUs estimate as part of CPU subsystem
const cpus = ctx.traceInfo.cpus;
for (const cpu of cpus) {
const queryKey = `cpu${cpu}_curve`;
const queryKey = `cpu${cpu}_mw`;
const uri = `/wattson/cpu_subsystem_estimate_cpu${cpu}`;
const title = `Cpu${cpu} Estimate`;
ctx.tracks.registerTrack({
Expand All @@ -63,7 +61,7 @@ export default class implements PerfettoPlugin {
ctx.tracks.registerTrack({
uri,
title,
track: new CpuSubsystemEstimateTrack(ctx, uri, `dsu_scu`),
track: new CpuSubsystemEstimateTrack(ctx, uri, `dsu_scu_mw`),
tags: {
kind: CPUSS_ESTIMATE_TRACK_KIND,
wattson: 'Dsu_Scu',
Expand All @@ -82,10 +80,10 @@ export default class implements PerfettoPlugin {
new WattsonThreadSelectionAggregator(),
);
ctx.selection.registerAreaSelectionAggreagtor(
new WattsonPackageSelectionAggregator(),
new WattsonProcessSelectionAggregator(),
);
ctx.selection.registerAreaSelectionAggreagtor(
new WattsonProcessSelectionAggregator(),
new WattsonPackageSelectionAggregator(),
);
}
}
Expand All @@ -98,6 +96,12 @@ class CpuSubsystemEstimateTrack extends BaseCounterTrack {
this.queryKey = queryKey;
}

async onInit() {
await this.engine.query(
`INCLUDE PERFETTO MODULE wattson.curves.estimates;`,
);
}

protected getDefaultCounterOptions(): CounterOptions {
const options = super.getDefaultCounterOptions();
options.yRangeSharingKey = `CpuSubsystem`;
Expand All @@ -106,19 +110,7 @@ class CpuSubsystemEstimateTrack extends BaseCounterTrack {
}

getSqlSource() {
if (this.queryKey.startsWith(`cpu`)) {
return `select ts, ${this.queryKey} as value from _system_state_curves`;
} else {
return `
select
ts,
-- L3 values are scaled by 1000 because it's divided by ns and L3 LUTs
-- are scaled by 10^6. This brings to same units as static_curve (mW)
((IFNULL(l3_hit_value, 0) + IFNULL(l3_miss_value, 0)) * 1000 / dur)
+ static_curve as value
from _system_state_curves
`;
}
return `select ts, ${this.queryKey} as value from _system_state_mw`;
}
}

Expand Down
3 changes: 3 additions & 0 deletions ui/src/plugins/org.kernel.Wattson/process_aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class WattsonProcessSelectionAggregator
// Prerequisite tables are already generated by Wattson thread aggregation,
// which is run prior to execution of this module
engine.query(`
INCLUDE PERFETTO MODULE wattson.curves.idle_attribution;
INCLUDE PERFETTO MODULE wattson.curves.estimates;
-- Only get idle attribution in user defined window and filter by selected
-- CPUs and GROUP BY process
CREATE OR REPLACE PERFETTO TABLE _per_process_idle_attribution AS
Expand Down
4 changes: 1 addition & 3 deletions ui/src/test/wattson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ const SCREEN_CLIP = {
test.beforeAll(async ({browser}, _testInfo) => {
page = await browser.newPage();
pth = new PerfettoTestHelper(page);
await pth.openTraceFile('wattson_dsu_pmu.pb', {
enablePlugins: 'org.kernel.Wattson',
});
await pth.openTraceFile('wattson_dsu_pmu.pb');
});

test('wattson aggregations', async () => {
Expand Down

0 comments on commit 56a2514

Please sign in to comment.