Lalit Maganti | 26f69bd | 2019-04-29 18:23:47 +0100 | [diff] [blame] | 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 | |
| 15 | import("../../../gn/perfetto.gni") |
| 16 | |
Lalit Maganti | 7177c7f | 2019-04-30 15:54:51 +0100 | [diff] [blame] | 17 | sql_files = [ |
| 18 | "android/android_mem.sql", |
| 19 | "android/android_mem_lmk.sql", |
Lalit Maganti | 5f3a018 | 2019-05-07 16:40:36 +0100 | [diff] [blame] | 20 | "android/android_mem_proc_counters.sql", |
Ioannis Ilkos | 20d5e8b | 2019-05-16 15:43:26 +0100 | [diff] [blame] | 21 | "android/android_startup_launches.sql", |
| 22 | "android/android_task_state.sql", |
| 23 | "android/android_startup.sql", |
Lalit Maganti | 7177c7f | 2019-04-30 15:54:51 +0100 | [diff] [blame] | 24 | ] |
Lalit Maganti | 26f69bd | 2019-04-29 18:23:47 +0100 | [diff] [blame] | 25 | |
| 26 | config("gen_config") { |
| 27 | include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ] |
| 28 | } |
| 29 | |
| 30 | action("gen_merged_sql_metrics") { |
Lalit Maganti | 697cc48 | 2019-05-01 14:39:11 +0100 | [diff] [blame] | 31 | script = "../../../tools/gen_merged_sql_metrics.py" |
Lalit Maganti | 26f69bd | 2019-04-29 18:23:47 +0100 | [diff] [blame] | 32 | generated_header = "${target_gen_dir}/sql_metrics.h" |
| 33 | args = rebase_path(sql_files, root_build_dir) + [ |
| 34 | "--cpp_out", |
| 35 | rebase_path(generated_header, root_build_dir), |
| 36 | ] |
| 37 | inputs = sql_files |
| 38 | outputs = [ |
| 39 | generated_header, |
| 40 | ] |
| 41 | public_configs = [ ":gen_config" ] |
| 42 | } |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 43 | |
| 44 | source_set("lib") { |
| 45 | sources = [ |
Lalit Maganti | 6221107 | 2019-05-10 14:09:58 +0100 | [diff] [blame] | 46 | "descriptors.cc", |
| 47 | "descriptors.h", |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 48 | "metrics.cc", |
Lalit Maganti | eb1bf21 | 2019-05-08 15:07:16 +0100 | [diff] [blame] | 49 | "metrics.descriptor.h", |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 50 | "metrics.h", |
| 51 | ] |
| 52 | deps = [ |
Lalit Maganti | 7177c7f | 2019-04-30 15:54:51 +0100 | [diff] [blame] | 53 | "../../../buildtools:sqlite", |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 54 | "../../../gn:default_deps", |
| 55 | "../../../include/perfetto/trace_processor", |
Lalit Maganti | 6221107 | 2019-05-10 14:09:58 +0100 | [diff] [blame] | 56 | "../../../protos/perfetto/common:zero", |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 57 | "../../../protos/perfetto/metrics:zero", |
| 58 | "../../../protos/perfetto/metrics/android:zero", |
Lalit Maganti | e59293b | 2019-05-22 15:07:39 +0100 | [diff] [blame^] | 59 | "../../../protos/perfetto/trace_processor:metrics_impl_zero", |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 60 | "../../protozero:protozero", |
| 61 | ] |
Lalit Maganti | 5ccd0a2 | 2019-05-15 16:48:04 +0100 | [diff] [blame] | 62 | public_deps = [ |
| 63 | ":gen_merged_sql_metrics", |
| 64 | ] |
Lalit Maganti | 622676a | 2019-04-30 14:15:37 +0100 | [diff] [blame] | 65 | } |
Lalit Maganti | 5f3a018 | 2019-05-07 16:40:36 +0100 | [diff] [blame] | 66 | |
| 67 | source_set("unittests") { |
| 68 | testonly = true |
| 69 | sources = [ |
| 70 | "metrics_unittest.cc", |
| 71 | ] |
| 72 | deps = [ |
| 73 | ":lib", |
| 74 | "../../../buildtools:sqlite", |
| 75 | "../../../gn:default_deps", |
| 76 | "../../../gn:gtest_deps", |
| 77 | ] |
| 78 | } |