1# Copyright (C) 2018 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("../../../gn/perfetto.gni") 16import("../../../gn/test.gni") 17 18sql_files = [ 19 "trace_metadata.sql", 20 "android/android_batt.sql", 21 "android/android_cpu.sql", 22 "android/android_cpu_agg.sql", 23 "android/android_cpu_raw_metrics_per_core.sql", 24 "android/android_mem.sql", 25 "android/android_mem_unagg.sql", 26 "android/android_ion.sql", 27 "android/android_lmk_reason.sql", 28 "android/android_lmk.sql", 29 "android/android_powrails.sql", 30 "android/android_startup_launches.sql", 31 "android/android_task_state.sql", 32 "android/android_startup.sql", 33 "android/android_package_list.sql", 34 "android/android_task_names.sql", 35 "android/android_thread_time_in_state.sql", 36 "android/cpu_info.sql", 37 "android/display_metrics.sql", 38 "android/heap_profile_callsites.sql", 39 "android/hsc_startups.sql", 40 "android/android_hwui_metric.sql", 41 "android/java_heap_histogram.sql", 42 "android/java_heap_stats.sql", 43 "android/process_unagg_mem_view.sql", 44 "android/process_mem.sql", 45 "android/process_metadata.sql", 46 "android/process_oom_score.sql", 47 "android/mem_stats_priority_breakdown.sql", 48 "android/span_view_stats.sql", 49 "android/process_counter_span_view.sql", 50 "android/counter_span_view.sql", 51 "android/unmapped_java_symbols.sql", 52 "android/unsymbolized_frames.sql", 53 "chrome/chrome_processes.sql", 54] 55 56config("gen_config") { 57 include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ] 58} 59 60action("gen_merged_sql_metrics") { 61 script = "../../../tools/gen_merged_sql_metrics.py" 62 generated_header = "${target_gen_dir}/sql_metrics.h" 63 args = rebase_path(sql_files, root_build_dir) + [ 64 "--cpp_out", 65 rebase_path(generated_header, root_build_dir), 66 ] 67 inputs = sql_files 68 outputs = [ generated_header ] 69 public_configs = [ ":gen_config" ] 70} 71 72if (enable_perfetto_trace_processor_sqlite) { 73 source_set("lib") { 74 sources = [ 75 "custom_options.descriptor.h", 76 "metrics.cc", 77 "metrics.descriptor.h", 78 "metrics.h", 79 ] 80 deps = [ 81 "..:metatrace", 82 "../../../gn:default_deps", 83 "../../../gn:sqlite", 84 "../../../include/perfetto/trace_processor", 85 "../../../protos/perfetto/common:zero", 86 "../../../protos/perfetto/metrics:zero", 87 "../../../protos/perfetto/metrics/android:zero", 88 "../../../protos/perfetto/trace_processor:metrics_impl_zero", 89 "../../base", 90 "../../protozero:protozero", 91 "../sqlite", 92 ] 93 public_deps = [ 94 ":gen_merged_sql_metrics", 95 "../util:descriptors", 96 ] 97 } 98 99 perfetto_unittest_source_set("unittests") { 100 testonly = true 101 sources = [ "metrics_unittest.cc" ] 102 deps = [ 103 ":lib", 104 "..:lib", 105 "../../../gn:default_deps", 106 "../../../gn:gtest_and_gmock", 107 "../../../gn:sqlite", 108 "../../../protos/perfetto/common:zero", 109 ] 110 } 111} 112