1-- 2-- Copyright 2024 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 16CREATE PERFETTO TABLE _ref_type_ids AS 17SELECT 18 id AS type_id 19FROM heap_graph_class 20WHERE 21 kind IN ('KIND_FINALIZER_REFERENCE', 'KIND_PHANTOM_REFERENCE', 'KIND_SOFT_REFERENCE', 'KIND_WEAK_REFERENCE') 22ORDER BY 23 type_id; 24 25CREATE PERFETTO TABLE _excluded_refs AS 26SELECT 27 ref.id 28FROM heap_graph_reference AS ref 29CROSS JOIN heap_graph_object AS robj 30 USING (reference_set_id) 31CROSS JOIN _ref_type_ids 32 USING (type_id) 33WHERE 34 ref.field_name = 'java.lang.ref.Reference.referent' 35ORDER BY 36 ref.id; 37