1/* 2 * Copyright (C) 2019 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 17-- filter for atrace writes 18CREATE VIEW IF NOT EXISTS tracing_mark_writes AS 19 SELECT * 20 FROM raw_ftrace_entries 21 WHERE function = 'tracing_mark_write'; 22 23-- split the tracing_mark_write function args by ||s 24DROP TABLE IF exists tracing_mark_write_split_array; 25 26CREATE TABLE tracing_mark_write_split_array ( 27 predictorset_id INT REFERENCES raw_ftrace_entries (id), 28 predictor_name, 29 rest, 30 gen, 31 32 UNIQUE(predictorset_id, gen) -- drops redundant inserts into table 33); 34 35CREATE INDEX "tracing_mark_write_split_array_id" ON tracing_mark_write_split_array ( 36 predictorset_id COLLATE BINARY COLLATE BINARY 37); 38 39INSERT INTO tracing_mark_write_split_array 40 WITH 41 split(predictorset_id, predictor_name, rest, gen) AS ( 42 -- split by | 43 SELECT id, '', function_args || '|', 0 FROM tracing_mark_writes WHERE id 44 UNION ALL 45 SELECT predictorset_id, 46 substr(rest, 0, instr(rest, '|')), 47 substr(rest, instr(rest, '|')+1), 48 gen + 1 49 FROM split 50 WHERE rest <> ''), 51 split_results AS ( 52 SELECT * FROM split WHERE predictor_name <> '' 53 ) 54 SELECT * from split_results 55; 56 57 58