1#!/usr/bin/env python3 2# Copyright (C) 2023 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 20CONSENT_MANAGER_INITIALIZATION_EVENT = "ConsentManager#Initialization" 21CONSENT_MANAGER_READ_EVENT = "ConsentManager#ReadOperation" 22CONSENT_MANAGER_WRITE_EVENT = "ConsentManager#WriteOperation" 23MAIN_ACTIVITY_CREATION_EVENT = "AdServicesSettingsMainActivity#OnCreate" 24 25AD_ID_CACHE_EVENT = "AdIdCacheEvent" 26APP_SET_ID_EVENT = "AppSetIdEvent" 27 28ODP_MANAGER_INITIALIZATION_EVENT = "OdpManagingService#Initialization" 29ODP_MANAGER_EXECUTE_EVENT = "OdpManagingServiceDelegate#Execute" 30ODP_MANAGER_REQUEST_SURFACE_PACKAGE_EVENT = "OdpManagingServiceDelegate#RequestSurfacePackage" 31ODP_MANAGER_REGISTER_WEB_TRIGGER_EVENT = "OdpManagingServiceDelegate#RegisterWebTrigger" 32 33trace = synth_common.create_trace() 34 35trace.add_ftrace_packet(cpu=0) 36 37trace.add_sys_enter(ts=100, tid=42, id=64) 38trace.add_sys_exit(ts=200, tid=42, id=64, ret=0) 39 40trace.add_atrace_begin( 41 ts=350, tid=42, pid=42, buf=CONSENT_MANAGER_INITIALIZATION_EVENT) 42trace.add_atrace_end(ts=650, tid=42, pid=42) 43 44trace.add_atrace_begin(ts=750, tid=42, pid=42, buf=AD_ID_CACHE_EVENT) 45trace.add_atrace_end(ts=850, tid=42, pid=42) 46 47trace.add_atrace_begin(ts=900, tid=42, pid=42, buf=APP_SET_ID_EVENT) 48trace.add_atrace_end(ts=1200, tid=42, pid=42) 49 50trace.add_atrace_begin(ts=1500, tid=43, pid=43, buf=CONSENT_MANAGER_READ_EVENT) 51trace.add_atrace_end(ts=1650, tid=43, pid=43) 52 53trace.add_atrace_begin( 54 ts=2500, tid=43, pid=44, buf=ODP_MANAGER_INITIALIZATION_EVENT) 55trace.add_atrace_end(ts=2550, tid=43, pid=44) 56trace.add_atrace_begin(ts=2600, tid=43, pid=44, buf=ODP_MANAGER_EXECUTE_EVENT) 57trace.add_atrace_end(ts=2700, tid=43, pid=44) 58trace.add_atrace_begin( 59 ts=2800, tid=43, pid=44, buf=ODP_MANAGER_REQUEST_SURFACE_PACKAGE_EVENT) 60trace.add_atrace_end(ts=2950, tid=43, pid=44) 61trace.add_atrace_begin( 62 ts=3000, tid=43, pid=44, buf=ODP_MANAGER_REGISTER_WEB_TRIGGER_EVENT) 63trace.add_atrace_end(ts=3200, tid=43, pid=44) 64 65sys.stdout.buffer.write(trace.trace.SerializeToString()) 66