tp: move SQL metric files into 'sql' folder

And also add an empty 'protos' folder to src/trace_processor/metrics

The union of these two changes means that src/trace_processor/metrics
can be passed as a 'metric extension path' to trace processor: follow up
changes will make it so that we can hot-reload the metrics folder
making local development of metrics very fast.

Change-Id: I568db8aa2ac9d2fc512ed80f8ef812b8f9d919ae
Bug: 190219056
diff --git a/Android.bp b/Android.bp
index 780930a..d00d85c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1753,7 +1753,7 @@
         ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
         ":perfetto_src_trace_processor_lib",
         ":perfetto_src_trace_processor_metatrace",
-        ":perfetto_src_trace_processor_metrics_lib",
+        ":perfetto_src_trace_processor_metrics_metrics",
         ":perfetto_src_trace_processor_sqlite_sqlite",
         ":perfetto_src_trace_processor_storage_full",
         ":perfetto_src_trace_processor_storage_minimal",
@@ -1885,7 +1885,7 @@
         "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
-        "perfetto_src_trace_processor_metrics_gen_merged_sql_metrics",
+        "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
     ],
     defaults: [
         "perfetto_defaults",
@@ -7965,7 +7965,7 @@
     ],
     cmd: "$(location tools/gen_cc_proto_descriptor.py) --gen_dir=$(genDir) --cpp_out=$(out) $(in)",
     out: [
-        "src/trace_processor/metrics/chrome/all_chrome_metrics.descriptor.h",
+        "src/trace_processor/metrics/all_chrome_metrics.descriptor.h",
     ],
     tool_files: [
         "tools/gen_cc_proto_descriptor.py",
@@ -7987,113 +7987,113 @@
     ],
 }
 
-// GN: //src/trace_processor/metrics:gen_merged_sql_metrics
-genrule {
-    name: "perfetto_src_trace_processor_metrics_gen_merged_sql_metrics",
+// GN: //src/trace_processor/metrics:metrics
+filegroup {
+    name: "perfetto_src_trace_processor_metrics_metrics",
     srcs: [
-        "src/trace_processor/metrics/android/android_batt.sql",
-        "src/trace_processor/metrics/android/android_camera.sql",
-        "src/trace_processor/metrics/android/android_cpu.sql",
-        "src/trace_processor/metrics/android/android_cpu_agg.sql",
-        "src/trace_processor/metrics/android/android_cpu_raw_metrics_per_core.sql",
-        "src/trace_processor/metrics/android/android_dma_heap.sql",
-        "src/trace_processor/metrics/android/android_fastrpc.sql",
-        "src/trace_processor/metrics/android/android_gpu.sql",
-        "src/trace_processor/metrics/android/android_hwcomposer.sql",
-        "src/trace_processor/metrics/android/android_hwui_metric.sql",
-        "src/trace_processor/metrics/android/android_hwui_threads.sql",
-        "src/trace_processor/metrics/android/android_ion.sql",
-        "src/trace_processor/metrics/android/android_jank.sql",
-        "src/trace_processor/metrics/android/android_lmk.sql",
-        "src/trace_processor/metrics/android/android_lmk_reason.sql",
-        "src/trace_processor/metrics/android/android_mem.sql",
-        "src/trace_processor/metrics/android/android_mem_unagg.sql",
-        "src/trace_processor/metrics/android/android_multiuser.sql",
-        "src/trace_processor/metrics/android/android_multiuser_populator.sql",
-        "src/trace_processor/metrics/android/android_package_list.sql",
-        "src/trace_processor/metrics/android/android_powrails.sql",
-        "src/trace_processor/metrics/android/android_proxy_power.sql",
-        "src/trace_processor/metrics/android/android_simpleperf.sql",
-        "src/trace_processor/metrics/android/android_startup.sql",
-        "src/trace_processor/metrics/android/android_surfaceflinger.sql",
-        "src/trace_processor/metrics/android/android_sysui_cuj.sql",
-        "src/trace_processor/metrics/android/android_sysui_cuj_jank_query.sql",
-        "src/trace_processor/metrics/android/android_task_names.sql",
-        "src/trace_processor/metrics/android/android_thread_time_in_state.sql",
-        "src/trace_processor/metrics/android/android_trace_quality.sql",
-        "src/trace_processor/metrics/android/composer_execution.sql",
-        "src/trace_processor/metrics/android/composition_layers.sql",
-        "src/trace_processor/metrics/android/cpu_info.sql",
-        "src/trace_processor/metrics/android/display_metrics.sql",
-        "src/trace_processor/metrics/android/frame_missed.sql",
-        "src/trace_processor/metrics/android/g2d.sql",
-        "src/trace_processor/metrics/android/g2d_duration.sql",
-        "src/trace_processor/metrics/android/global_counter_span_view.sql",
-        "src/trace_processor/metrics/android/gpu_counter_span_view.sql",
-        "src/trace_processor/metrics/android/java_heap_histogram.sql",
-        "src/trace_processor/metrics/android/java_heap_stats.sql",
-        "src/trace_processor/metrics/android/mem_stats_priority_breakdown.sql",
-        "src/trace_processor/metrics/android/power_drain_in_watts.sql",
-        "src/trace_processor/metrics/android/power_profile_data.sql",
-        "src/trace_processor/metrics/android/process_counter_span_view.sql",
-        "src/trace_processor/metrics/android/process_mem.sql",
-        "src/trace_processor/metrics/android/process_metadata.sql",
-        "src/trace_processor/metrics/android/process_oom_score.sql",
-        "src/trace_processor/metrics/android/process_unagg_mem_view.sql",
-        "src/trace_processor/metrics/android/profiler_smaps.sql",
-        "src/trace_processor/metrics/android/span_view_stats.sql",
-        "src/trace_processor/metrics/android/startup/hsc.sql",
-        "src/trace_processor/metrics/android/startup/launches.sql",
-        "src/trace_processor/metrics/android/thread_counter_span_view.sql",
-        "src/trace_processor/metrics/android/unsymbolized_frames.sql",
-        "src/trace_processor/metrics/chrome/actual_power_by_category.sql",
-        "src/trace_processor/metrics/chrome/actual_power_by_rail_mode.sql",
-        "src/trace_processor/metrics/chrome/chrome_event_metadata.sql",
-        "src/trace_processor/metrics/chrome/chrome_processes.sql",
-        "src/trace_processor/metrics/chrome/chrome_thread_slice_with_cpu_time.sql",
-        "src/trace_processor/metrics/chrome/cpu_time_by_category.sql",
-        "src/trace_processor/metrics/chrome/cpu_time_by_rail_mode.sql",
-        "src/trace_processor/metrics/chrome/estimated_power_by_category.sql",
-        "src/trace_processor/metrics/chrome/estimated_power_by_rail_mode.sql",
-        "src/trace_processor/metrics/chrome/gesture_flow_event.sql",
-        "src/trace_processor/metrics/chrome/gesture_flow_event_queuing_delay.sql",
-        "src/trace_processor/metrics/chrome/gesture_jank.sql",
-        "src/trace_processor/metrics/chrome/rail_modes.sql",
-        "src/trace_processor/metrics/chrome/scroll_flow_event.sql",
-        "src/trace_processor/metrics/chrome/scroll_flow_event_queuing_delay.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank_cause.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank_cause_blocking_task.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank_cause_blocking_touch_move.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank_cause_get_bitmap.sql",
-        "src/trace_processor/metrics/chrome/scroll_jank_cause_queuing_delay.sql",
-        "src/trace_processor/metrics/chrome/test_chrome_metric.sql",
-        "src/trace_processor/metrics/chrome/touch_flow_event.sql",
-        "src/trace_processor/metrics/chrome/touch_flow_event_queuing_delay.sql",
-        "src/trace_processor/metrics/chrome/touch_jank.sql",
-        "src/trace_processor/metrics/experimental/blink_gc_metric.sql",
-        "src/trace_processor/metrics/experimental/chrome_dropped_frames.sql",
-        "src/trace_processor/metrics/experimental/frame_times.sql",
-        "src/trace_processor/metrics/experimental/media_metric.sql",
-        "src/trace_processor/metrics/experimental/reported_by_page.sql",
-        "src/trace_processor/metrics/trace_metadata.sql",
-        "src/trace_processor/metrics/trace_stats.sql",
-        "src/trace_processor/metrics/webview/webview_power_usage.sql",
-    ],
-    cmd: "$(location tools/gen_merged_sql_metrics.py) --cpp_out=$(out) $(in)",
-    out: [
-        "src/trace_processor/metrics/sql_metrics.h",
-    ],
-    tool_files: [
-        "tools/gen_merged_sql_metrics.py",
+        "src/trace_processor/metrics/metrics.cc",
     ],
 }
 
-// GN: //src/trace_processor/metrics:lib
-filegroup {
-    name: "perfetto_src_trace_processor_metrics_lib",
+// GN: //src/trace_processor/metrics/sql:gen_amalgamated_sql_metrics
+genrule {
+    name: "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
     srcs: [
-        "src/trace_processor/metrics/metrics.cc",
+        "src/trace_processor/metrics/sql/android/android_batt.sql",
+        "src/trace_processor/metrics/sql/android/android_camera.sql",
+        "src/trace_processor/metrics/sql/android/android_cpu.sql",
+        "src/trace_processor/metrics/sql/android/android_cpu_agg.sql",
+        "src/trace_processor/metrics/sql/android/android_cpu_raw_metrics_per_core.sql",
+        "src/trace_processor/metrics/sql/android/android_dma_heap.sql",
+        "src/trace_processor/metrics/sql/android/android_fastrpc.sql",
+        "src/trace_processor/metrics/sql/android/android_gpu.sql",
+        "src/trace_processor/metrics/sql/android/android_hwcomposer.sql",
+        "src/trace_processor/metrics/sql/android/android_hwui_metric.sql",
+        "src/trace_processor/metrics/sql/android/android_hwui_threads.sql",
+        "src/trace_processor/metrics/sql/android/android_ion.sql",
+        "src/trace_processor/metrics/sql/android/android_jank.sql",
+        "src/trace_processor/metrics/sql/android/android_lmk.sql",
+        "src/trace_processor/metrics/sql/android/android_lmk_reason.sql",
+        "src/trace_processor/metrics/sql/android/android_mem.sql",
+        "src/trace_processor/metrics/sql/android/android_mem_unagg.sql",
+        "src/trace_processor/metrics/sql/android/android_multiuser.sql",
+        "src/trace_processor/metrics/sql/android/android_multiuser_populator.sql",
+        "src/trace_processor/metrics/sql/android/android_package_list.sql",
+        "src/trace_processor/metrics/sql/android/android_powrails.sql",
+        "src/trace_processor/metrics/sql/android/android_proxy_power.sql",
+        "src/trace_processor/metrics/sql/android/android_simpleperf.sql",
+        "src/trace_processor/metrics/sql/android/android_startup.sql",
+        "src/trace_processor/metrics/sql/android/android_surfaceflinger.sql",
+        "src/trace_processor/metrics/sql/android/android_sysui_cuj.sql",
+        "src/trace_processor/metrics/sql/android/android_sysui_cuj_jank_query.sql",
+        "src/trace_processor/metrics/sql/android/android_task_names.sql",
+        "src/trace_processor/metrics/sql/android/android_thread_time_in_state.sql",
+        "src/trace_processor/metrics/sql/android/android_trace_quality.sql",
+        "src/trace_processor/metrics/sql/android/composer_execution.sql",
+        "src/trace_processor/metrics/sql/android/composition_layers.sql",
+        "src/trace_processor/metrics/sql/android/cpu_info.sql",
+        "src/trace_processor/metrics/sql/android/display_metrics.sql",
+        "src/trace_processor/metrics/sql/android/frame_missed.sql",
+        "src/trace_processor/metrics/sql/android/g2d.sql",
+        "src/trace_processor/metrics/sql/android/g2d_duration.sql",
+        "src/trace_processor/metrics/sql/android/global_counter_span_view.sql",
+        "src/trace_processor/metrics/sql/android/gpu_counter_span_view.sql",
+        "src/trace_processor/metrics/sql/android/java_heap_histogram.sql",
+        "src/trace_processor/metrics/sql/android/java_heap_stats.sql",
+        "src/trace_processor/metrics/sql/android/mem_stats_priority_breakdown.sql",
+        "src/trace_processor/metrics/sql/android/power_drain_in_watts.sql",
+        "src/trace_processor/metrics/sql/android/power_profile_data.sql",
+        "src/trace_processor/metrics/sql/android/process_counter_span_view.sql",
+        "src/trace_processor/metrics/sql/android/process_mem.sql",
+        "src/trace_processor/metrics/sql/android/process_metadata.sql",
+        "src/trace_processor/metrics/sql/android/process_oom_score.sql",
+        "src/trace_processor/metrics/sql/android/process_unagg_mem_view.sql",
+        "src/trace_processor/metrics/sql/android/profiler_smaps.sql",
+        "src/trace_processor/metrics/sql/android/span_view_stats.sql",
+        "src/trace_processor/metrics/sql/android/startup/hsc.sql",
+        "src/trace_processor/metrics/sql/android/startup/launches.sql",
+        "src/trace_processor/metrics/sql/android/thread_counter_span_view.sql",
+        "src/trace_processor/metrics/sql/android/unsymbolized_frames.sql",
+        "src/trace_processor/metrics/sql/chrome/actual_power_by_category.sql",
+        "src/trace_processor/metrics/sql/chrome/actual_power_by_rail_mode.sql",
+        "src/trace_processor/metrics/sql/chrome/chrome_event_metadata.sql",
+        "src/trace_processor/metrics/sql/chrome/chrome_processes.sql",
+        "src/trace_processor/metrics/sql/chrome/chrome_thread_slice_with_cpu_time.sql",
+        "src/trace_processor/metrics/sql/chrome/cpu_time_by_category.sql",
+        "src/trace_processor/metrics/sql/chrome/cpu_time_by_rail_mode.sql",
+        "src/trace_processor/metrics/sql/chrome/estimated_power_by_category.sql",
+        "src/trace_processor/metrics/sql/chrome/estimated_power_by_rail_mode.sql",
+        "src/trace_processor/metrics/sql/chrome/gesture_flow_event.sql",
+        "src/trace_processor/metrics/sql/chrome/gesture_flow_event_queuing_delay.sql",
+        "src/trace_processor/metrics/sql/chrome/gesture_jank.sql",
+        "src/trace_processor/metrics/sql/chrome/rail_modes.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_flow_event.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_flow_event_queuing_delay.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank_cause.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank_cause_blocking_task.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank_cause_blocking_touch_move.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank_cause_get_bitmap.sql",
+        "src/trace_processor/metrics/sql/chrome/scroll_jank_cause_queuing_delay.sql",
+        "src/trace_processor/metrics/sql/chrome/test_chrome_metric.sql",
+        "src/trace_processor/metrics/sql/chrome/touch_flow_event.sql",
+        "src/trace_processor/metrics/sql/chrome/touch_flow_event_queuing_delay.sql",
+        "src/trace_processor/metrics/sql/chrome/touch_jank.sql",
+        "src/trace_processor/metrics/sql/experimental/blink_gc_metric.sql",
+        "src/trace_processor/metrics/sql/experimental/chrome_dropped_frames.sql",
+        "src/trace_processor/metrics/sql/experimental/frame_times.sql",
+        "src/trace_processor/metrics/sql/experimental/media_metric.sql",
+        "src/trace_processor/metrics/sql/experimental/reported_by_page.sql",
+        "src/trace_processor/metrics/sql/trace_metadata.sql",
+        "src/trace_processor/metrics/sql/trace_stats.sql",
+        "src/trace_processor/metrics/sql/webview/webview_power_usage.sql",
+    ],
+    cmd: "$(location tools/gen_amalgamated_sql_metrics.py) --cpp_out=$(out) $(in)",
+    out: [
+        "src/trace_processor/metrics/sql/amalgamated_sql_metrics.h",
+    ],
+    tool_files: [
+        "tools/gen_amalgamated_sql_metrics.py",
     ],
 }
 
@@ -9342,7 +9342,7 @@
         ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
         ":perfetto_src_trace_processor_lib",
         ":perfetto_src_trace_processor_metatrace",
-        ":perfetto_src_trace_processor_metrics_lib",
+        ":perfetto_src_trace_processor_metrics_metrics",
         ":perfetto_src_trace_processor_metrics_unittests",
         ":perfetto_src_trace_processor_rpc_rpc",
         ":perfetto_src_trace_processor_rpc_unittests",
@@ -9534,7 +9534,7 @@
         "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
-        "perfetto_src_trace_processor_metrics_gen_merged_sql_metrics",
+        "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
         "perfetto_src_traced_probes_ftrace_test_messages_cpp_gen_headers",
         "perfetto_src_traced_probes_ftrace_test_messages_lite_gen_headers",
         "perfetto_src_traced_probes_ftrace_test_messages_zero_gen_headers",
@@ -9642,7 +9642,7 @@
         ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
         ":perfetto_src_trace_processor_lib",
         ":perfetto_src_trace_processor_metatrace",
-        ":perfetto_src_trace_processor_metrics_lib",
+        ":perfetto_src_trace_processor_metrics_metrics",
         ":perfetto_src_trace_processor_rpc_httpd",
         ":perfetto_src_trace_processor_rpc_rpc",
         ":perfetto_src_trace_processor_sqlite_sqlite",
@@ -9697,7 +9697,7 @@
         "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
-        "perfetto_src_trace_processor_metrics_gen_merged_sql_metrics",
+        "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
     ],
     defaults: [
         "perfetto_defaults",
@@ -9796,7 +9796,7 @@
         ":perfetto_src_trace_processor_importers_memory_tracker_graph_processor",
         ":perfetto_src_trace_processor_lib",
         ":perfetto_src_trace_processor_metatrace",
-        ":perfetto_src_trace_processor_metrics_lib",
+        ":perfetto_src_trace_processor_metrics_metrics",
         ":perfetto_src_trace_processor_sqlite_sqlite",
         ":perfetto_src_trace_processor_storage_full",
         ":perfetto_src_trace_processor_storage_minimal",
@@ -9856,7 +9856,7 @@
         "perfetto_src_trace_processor_importers_gen_cc_track_event_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_all_chrome_metrics_descriptor",
         "perfetto_src_trace_processor_metrics_gen_cc_metrics_descriptor",
-        "perfetto_src_trace_processor_metrics_gen_merged_sql_metrics",
+        "perfetto_src_trace_processor_metrics_sql_gen_amalgamated_sql_metrics",
         "perfetto_tools_trace_to_text_gen_cc_trace_descriptor",
     ],
     defaults: [