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_packet() 22trace.add_process(1, 0, 'init') 23trace.add_process(2, 1, 'system_server') 24trace.add_process(3, 1, 'com.google.android.calendar', 10001) 25 26trace.add_debuggable_package_list( 27 ts=1, name='com.google.android.calendar', uid=10001, version_code=123) 28 29trace.add_ftrace_packet(cpu=0) 30trace.add_atrace_async_begin(ts=110, tid=2, pid=2, buf='launchingActivity#1') 31trace.add_atrace_async_end(ts=210, tid=2, pid=2, buf='launchingActivity#1') 32trace.add_atrace_instant( 33 ts=211, 34 tid=2, 35 pid=2, 36 buf='launchingActivity#1:completed:com.google.android.calendar') 37 38trace.add_atrace_async_begin(ts=220, tid=2, pid=2, buf='launchingActivity#2') 39trace.add_atrace_async_end(ts=230, tid=2, pid=2, buf='launchingActivity#2') 40trace.add_atrace_instant( 41 ts=231, 42 tid=2, 43 pid=2, 44 buf='launchingActivity#2:completed-hot:com.google.android.calendar') 45# Emulate a hot start (and therefore that we only see activityResume). 46trace.add_atrace_begin(ts=221, tid=3, pid=3, buf='activityResume') 47trace.add_atrace_end(ts=225, tid=3, pid=3) 48 49sys.stdout.buffer.write(trace.trace.SerializeToString()) 50