Skip to content

Commit

Permalink
Non-GPU Counters in GPU Counters (#53)
Browse files Browse the repository at this point in the history
* power tracks and Global counters moved

* Memory Usage track Group

* PR Comments

* Query for GPU Counters

* Use a template literal

* Query all counter names at once
  • Loading branch information
ALevansSamsung authored Oct 19, 2023
1 parent 2769b6b commit 355d3f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 20 additions & 2 deletions ui/src/controller/track_decider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ const NETWORK_TRACK_REGEX = new RegExp('^.* (Received|Transmitted)( KB)?$');
const NETWORK_TRACK_GROUP = 'Networking';
const ENTITY_RESIDENCY_REGEX = new RegExp('^Entity residency:');
const ENTITY_RESIDENCY_GROUP = 'Entity residency';
const BATTERY_TRACK_REGEX = new RegExp('^batt\\..*$');
const BATTERY_TRACK_REGEX = new RegExp('^(batt|power)\\..*$');
const BATTERY_TRACK_GROUP = 'Battery';

// Sets the default 'scale' for counter tracks. If the regex matches
// then the paired mode is used. Entries are in priority order so the
// first match wins.
Expand Down Expand Up @@ -416,6 +415,24 @@ class TrackDecider {
}
}

async groupCounterTracks(): Promise<void> {
const counterTracks : string[] = [];
const iter = (await this.engine.query(`select name from gpu_counter_track`)).iter({name: STR});
for (; iter.valid(); iter.next()) {
counterTracks.push(iter.name);
}
for (const track of this.tracksToAdd) {
if (track.kind !== COUNTER_TRACK_KIND ||
(track.trackGroup && track.trackGroup !== SCROLLING_TRACK_GROUP)) {
continue;
}
if (counterTracks.includes(track.name)) {
track.trackGroup = this.lazyTrackGroup('GPU Counters', {collapsed: false, parentGroup: this.gpuGroup()})();
} else {
track.trackGroup = this.lazyTrackGroup('Memory Usage')();
}
}
}
async addScrollJankTracks(engine: Engine): Promise<void> {
const topLevelScrolls = addTopLevelScrollTrack(engine);
const topLevelScrollsResult = await topLevelScrolls;
Expand Down Expand Up @@ -2430,6 +2447,7 @@ class TrackDecider {
this.engine.getProxy('TrackDecider::groupGpuTracks'));
await this.addSurfaceFlingerTrackGroups(
this.engine.getProxy('TrackDecider::addSurfaceflingerTrackGroups'));
await this.groupCounterTracks();

// TODO(hjd): Move into plugin API.
{
Expand Down
1 change: 0 additions & 1 deletion ui/src/tracks/counter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ async function globalTrackProvider(engine: EngineProxy): Promise<TrackInfo[]> {
trackKind: COUNTER_TRACK_KIND,
name,
description,
group: 'GPU Counters',
config: {
name,
trackId,
Expand Down

0 comments on commit 355d3f2

Please sign in to comment.