• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# Copyright (C) 2018 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, path
17
18import synth_common
19
20trace = synth_common.create_trace()
21trace.add_system_info(fingerprint="fingerprint/walleye/P")
22
23trace.add_ftrace_packet(cpu=0)
24
25# CPU counters for CPU 0.
26trace.add_cpufreq(ts=9 * 1000000, freq=500000, cpu=0)
27trace.add_cpufreq(ts=15 * 1000000, freq=1400000, cpu=0)
28trace.add_cpufreq(ts=17 * 1000000, freq=2500000, cpu=0)
29
30# CPU counters for CPU 6.
31trace.add_cpufreq(ts=11 * 1000000, freq=2000000, cpu=6)
32trace.add_cpufreq(ts=15 * 1000000, freq=8000000, cpu=6)
33
34# Add 3 processes. This also adds one main thread per process.
35trace.add_packet()
36trace.add_process(pid=1, ppid=0, cmdline="Process1")
37trace.add_process(pid=2, ppid=0, cmdline="Process2")
38trace.add_process(pid=3, ppid=0, cmdline="Process3")
39
40# Add 3 additional threads.
41trace.add_thread(tid=4, tgid=1, cmdline="p1-t2")
42trace.add_thread(tid=5, tgid=2, cmdline="p2-t2")
43trace.add_thread(tid=6, tgid=2, cmdline="p2-t3")
44
45# Schedule threads in CPU 0.
46trace.add_ftrace_packet(cpu=0)
47trace.add_sched(ts=10 * 1000000, prev_pid=0, next_pid=1)
48trace.add_sched(ts=12 * 1000000, prev_pid=1, next_pid=3)
49trace.add_sched(ts=16 * 1000000, prev_pid=3, next_pid=4)
50trace.add_sched(ts=17 * 1000000, prev_pid=4, next_pid=2)
51trace.add_sched(ts=19 * 1000000, prev_pid=2, next_pid=0)
52
53# Schedule threads in CPU 6.
54trace.add_ftrace_packet(cpu=6)
55trace.add_sched(ts=11 * 1000000, prev_pid=0, next_pid=5)
56trace.add_sched(ts=13 * 1000000, prev_pid=5, next_pid=6)
57trace.add_sched(ts=16 * 1000000, prev_pid=6, next_pid=3)
58trace.add_sched(ts=18 * 1000000, prev_pid=3, next_pid=0)
59
60sys.stdout.buffer.write(trace.trace.SerializeToString())
61