1#!/usr/bin/env python3
2# Copyright (C) 2020 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from os import sys
17
18import synth_common
19
20trace = synth_common.create_trace()
21
22track1 = 1234
23track2 = 4567
24
25trace.add_process_track_descriptor(track1, pid=0)
26trace.add_process_track_descriptor(track2, pid=2)
27
28trace.add_rail_mode_slice(
29    ts=0,
30    dur=10000,
31    track=track1,
32    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_RESPONSE)
33trace.add_rail_mode_slice(
34    ts=10000,
35    dur=20000,
36    track=track1,
37    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_LOAD)
38trace.add_rail_mode_slice(
39    ts=30000,
40    dur=-1,
41    track=track1,
42    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_IDLE)
43
44trace.add_rail_mode_slice(
45    ts=0,
46    dur=10000,
47    track=track2,
48    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_ANIMATION)
49trace.add_rail_mode_slice(
50    ts=10000,
51    dur=25000,
52    track=track2,
53    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_IDLE)
54trace.add_rail_mode_slice(
55    ts=25000,
56    dur=10000,
57    track=track2,
58    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_ANIMATION)
59trace.add_rail_mode_slice(
60    ts=35000,
61    dur=10000,
62    track=track2,
63    mode=trace.prototypes.ChromeRAILMode.RAIL_MODE_IDLE)
64
65sys.stdout.buffer.write(trace.trace.SerializeToString())
66