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