• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2023 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15import {HSLColor} from '../../base/color';
16import {makeColorScheme} from '../../components/colorizer';
17import {Trace} from '../../public/trace';
18import {SourceDataset} from '../../trace_processor/dataset';
19import {LONG, NUM, STR} from '../../trace_processor/query_result';
20import {DatasetSliceTrack} from '../../components/tracks/dataset_slice_track';
21import {ThreadSliceDetailsPanel} from '../../components/details/thread_slice_details_tab';
22
23const GREEN = makeColorScheme(new HSLColor('#4CAF50')); // Green 500
24
25export function createExpectedFramesTrack(
26  trace: Trace,
27  uri: string,
28  maxDepth: number,
29  trackIds: ReadonlyArray<number>,
30) {
31  return new DatasetSliceTrack({
32    trace,
33    uri,
34    initialMaxDepth: maxDepth,
35    rootTableName: 'slice',
36    dataset: new SourceDataset({
37      src: 'expected_frame_timeline_slice',
38      schema: {
39        ts: LONG,
40        dur: LONG,
41        name: STR,
42        id: NUM,
43      },
44      filter: {
45        col: 'track_id',
46        in: trackIds,
47      },
48    }),
49    colorizer: () => GREEN,
50    detailsPanel: () => new ThreadSliceDetailsPanel(trace),
51  });
52}
53