| # Copyright (C) 2018 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("../../../gn/perfetto.gni") |
| import("../../../gn/test.gni") |
| |
| sql_files = [ |
| "trace_metadata.sql", |
| "trace_stats.sql", |
| "android/android_batt.sql", |
| "android/android_camera.sql", |
| "android/android_cpu.sql", |
| "android/android_surfaceflinger.sql", |
| "android/android_cpu_agg.sql", |
| "android/android_cpu_raw_metrics_per_core.sql", |
| "android/android_dma_heap.sql", |
| "android/android_fastrpc.sql", |
| "android/android_gpu.sql", |
| "android/android_hwui_threads.sql", |
| "android/android_mem.sql", |
| "android/android_mem_unagg.sql", |
| "android/android_ion.sql", |
| "android/composer_execution.sql", |
| "android/composition_layers.sql", |
| "android/frame_missed.sql", |
| "android/android_jank.sql", |
| "android/android_lmk_reason.sql", |
| "android/android_lmk.sql", |
| "android/android_powrails.sql", |
| "android/android_proxy_power.sql", |
| "android/android_simpleperf.sql", |
| "android/android_startup.sql", |
| "android/android_package_list.sql", |
| "android/android_task_names.sql", |
| "android/android_thread_time_in_state.sql", |
| "android/android_trace_quality.sql", |
| "android/cpu_info.sql", |
| "android/display_metrics.sql", |
| "android/g2d.sql", |
| "android/g2d_duration.sql", |
| "android/android_hwcomposer.sql", |
| "android/android_hwui_metric.sql", |
| "android/java_heap_histogram.sql", |
| "android/java_heap_stats.sql", |
| "android/power_drain_in_watts.sql", |
| "android/power_profile_data.sql", |
| "android/process_unagg_mem_view.sql", |
| "android/process_mem.sql", |
| "android/process_metadata.sql", |
| "android/process_oom_score.sql", |
| "android/profiler_smaps.sql", |
| "android/mem_stats_priority_breakdown.sql", |
| "android/android_multiuser.sql", |
| "android/android_multiuser_populator.sql", |
| "android/span_view_stats.sql", |
| "android/android_sysui_cuj.sql", |
| "android/android_sysui_cuj_jank_query.sql", |
| "android/process_counter_span_view.sql", |
| "android/global_counter_span_view.sql", |
| "android/gpu_counter_span_view.sql", |
| "android/thread_counter_span_view.sql", |
| "android/unsymbolized_frames.sql", |
| "android/startup/launches.sql", |
| "android/startup/hsc.sql", |
| "chrome/actual_power_by_category.sql", |
| "chrome/actual_power_by_rail_mode.sql", |
| "chrome/chrome_event_metadata.sql", |
| "chrome/chrome_processes.sql", |
| "chrome/chrome_thread_slice_with_cpu_time.sql", |
| "chrome/cpu_time_by_category.sql", |
| "chrome/cpu_time_by_rail_mode.sql", |
| "chrome/estimated_power_by_category.sql", |
| "chrome/estimated_power_by_rail_mode.sql", |
| "chrome/gesture_jank.sql", |
| "chrome/gesture_flow_event.sql", |
| "chrome/gesture_flow_event_queuing_delay.sql", |
| "chrome/rail_modes.sql", |
| "chrome/scroll_jank.sql", |
| "chrome/scroll_jank_cause.sql", |
| "chrome/scroll_jank_cause_blocking_task.sql", |
| "chrome/scroll_jank_cause_blocking_touch_move.sql", |
| "chrome/scroll_jank_cause_get_bitmap.sql", |
| "chrome/scroll_jank_cause_queuing_delay.sql", |
| "chrome/scroll_flow_event.sql", |
| "chrome/scroll_flow_event_queuing_delay.sql", |
| "chrome/test_chrome_metric.sql", |
| "chrome/touch_flow_event.sql", |
| "chrome/touch_flow_event_queuing_delay.sql", |
| "chrome/touch_jank.sql", |
| "experimental/blink_gc_metric.sql", |
| "experimental/chrome_dropped_frames.sql", |
| "experimental/frame_times.sql", |
| "experimental/media_metric.sql", |
| "experimental/reported_by_page.sql", |
| "webview/webview_power_usage.sql", |
| ] |
| |
| config("gen_config") { |
| include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ] |
| } |
| |
| action("gen_merged_sql_metrics") { |
| script = "../../../tools/gen_merged_sql_metrics.py" |
| generated_header = "${target_gen_dir}/sql_metrics.h" |
| args = rebase_path(sql_files, root_build_dir) + [ |
| "--cpp_out", |
| rebase_path(generated_header, root_build_dir), |
| ] |
| inputs = sql_files |
| outputs = [ generated_header ] |
| public_configs = [ ":gen_config" ] |
| } |
| |
| action("gen_cc_metrics_descriptor") { |
| descriptor_target = "../../../protos/perfetto/metrics:descriptor" |
| generated_header = "${target_gen_dir}/metrics.descriptor.h" |
| |
| descriptor_file_path = get_label_info(descriptor_target, "target_gen_dir") + |
| "/metrics.descriptor" |
| |
| script = "../../../tools/gen_cc_proto_descriptor.py" |
| deps = [ descriptor_target ] |
| args = [ |
| "--gen_dir", |
| rebase_path(root_gen_dir, root_build_dir), |
| "--cpp_out", |
| rebase_path(generated_header, root_build_dir), |
| rebase_path(descriptor_file_path, root_build_dir), |
| ] |
| inputs = [ descriptor_file_path ] |
| outputs = [ generated_header ] |
| public_configs = [ ":gen_config" ] |
| } |
| |
| action("gen_cc_all_chrome_metrics_descriptor") { |
| descriptor_target = "../../../protos/perfetto/metrics/chrome:descriptor" |
| generated_header = "${target_gen_dir}/chrome/all_chrome_metrics.descriptor.h" |
| |
| descriptor_file_path = get_label_info(descriptor_target, "target_gen_dir") + |
| "/all_chrome_metrics.descriptor" |
| |
| script = "../../../tools/gen_cc_proto_descriptor.py" |
| deps = [ descriptor_target ] |
| args = [ |
| "--gen_dir", |
| rebase_path(root_gen_dir, root_build_dir), |
| "--cpp_out", |
| rebase_path(generated_header, root_build_dir), |
| rebase_path(descriptor_file_path, root_build_dir), |
| ] |
| inputs = [ descriptor_file_path ] |
| outputs = [ generated_header ] |
| public_configs = [ ":gen_config" ] |
| } |
| |
| if (enable_perfetto_trace_processor_sqlite) { |
| source_set("lib") { |
| sources = [ |
| "metrics.cc", |
| "metrics.h", |
| ] |
| deps = [ |
| "..:metatrace", |
| "../../../gn:default_deps", |
| "../../../gn:sqlite", |
| "../../../include/perfetto/trace_processor", |
| "../../../protos/perfetto/common:zero", |
| "../../../protos/perfetto/trace_processor:metrics_impl_zero", |
| "../../base", |
| "../../protozero:protozero", |
| "../sqlite", |
| ] |
| public_deps = [ |
| ":gen_cc_all_chrome_metrics_descriptor", |
| ":gen_cc_metrics_descriptor", |
| ":gen_merged_sql_metrics", |
| "../util", |
| "../util:descriptors", |
| ] |
| } |
| |
| perfetto_unittest_source_set("unittests") { |
| testonly = true |
| sources = [ "metrics_unittest.cc" ] |
| deps = [ |
| ":lib", |
| "..:lib", |
| "../../../gn:default_deps", |
| "../../../gn:gtest_and_gmock", |
| "../../../gn:sqlite", |
| "../../../protos/perfetto/common:zero", |
| ] |
| } |
| } |