• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 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--     https://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-- Some slice names have params in them. This functions removes them to make it
17-- possible to aggregate by name.
18-- Some examples are:
19--  - Lock/monitor contention slices. The name includes where the lock
20--    contention is in the code. That part is removed.
21--  - DrawFrames/ooFrame. The name also includes the frame number.
22--  - Apk/oat/dex loading: The name of the apk is removed
23--
24-- @arg name STRING   Raw name of the slice
25-- @ret STRING        Simplified name.
26SELECT CREATE_FUNCTION(
27    'ANDROID_STANDARDIZE_SLICE_NAME(name STRING)',
28    'STRING',
29    '
30    SELECT
31        CASE
32        WHEN $name GLOB "Lock contention on*" THEN "Lock contention on <...>"
33        WHEN $name GLOB "monitor contention with*" THEN "monitor contention with <...>"
34        WHEN $name GLOB "SuspendThreadByThreadId*" THEN "SuspendThreadByThreadId <...>"
35        WHEN $name GLOB "LoadApkAssetsFd*" THEN "LoadApkAssetsFd <...>"
36        WHEN $name GLOB "relayoutWindow*" THEN "relayoutWindow <...>"
37        WHEN $name GLOB "*CancellableContinuationImpl*" THEN "CoroutineContinuation"
38        WHEN $name GLOB "Choreographer#doFrame*" THEN "Choreographer#doFrame"
39        WHEN $name GLOB "DrawFrames*" THEN "DrawFrames"
40        WHEN $name GLOB "/data/app*.apk" THEN "APK load"
41        WHEN $name GLOB "OpenDexFilesFromOat*" THEN "OpenDexFilesFromOat"
42        WHEN $name GLOB "Open oat file*" THEN "Open oat file"
43        ELSE $name
44        END
45');