1#!/usr/bin/env python3 2# Copyright (C) 2021 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 16# This synthetic trace tests handling of the mm_id field in the rss_stat 17# event when mm_structs are reused on process death. 18 19from os import sys, path 20 21import synth_common 22 23trace = synth_common.create_trace() 24 25trace.add_packet(ts=1) 26trace.add_process(10, 1, "parent_process") 27trace.add_process(11, 10, "child_process") 28 29trace.add_ftrace_packet(1) 30 31trace.add_print( 32 ts=99, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|7') 33trace.add_print( 34 ts=100, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|5') 35trace.add_print( 36 ts=101, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|6') 37trace.add_print( 38 ts=102, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|0') 39trace.add_print( 40 ts=103, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|4') 41trace.add_print( 42 ts=104, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|6') 43trace.add_print( 44 ts=105, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|0') 45trace.add_print( 46 ts=106, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|4') 47trace.add_print( 48 ts=107, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|5') 49trace.add_print( 50 ts=108, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|0') 51trace.add_print( 52 ts=108, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|3') 53trace.add_print( 54 ts=108, tid=11, buf='C|10|HWComposer: Total Layer for PrimaryDisplay(0)|0') 55 56trace.add_print( 57 ts=109, 58 tid=11, 59 buf='C|10|HWComposer: Total Layer for SecondaryDisplay(1)|5') 60 61sys.stdout.buffer.write(trace.trace.SerializeToString()) 62