blob: d1b0000a71b53aec18730257785454bf8d4243d6 [file] [log] [blame]
Lalit Maganti26f69bd2019-04-29 18:23:47 +01001# 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")
16
Lalit Maganti7177c7f2019-04-30 15:54:51 +010017sql_files = [
18 "android/android_mem.sql",
19 "android/android_mem_lmk.sql",
Lalit Maganti5f3a0182019-05-07 16:40:36 +010020 "android/android_mem_proc_counters.sql",
Ioannis Ilkos20d5e8b2019-05-16 15:43:26 +010021 "android/android_startup_launches.sql",
22 "android/android_task_state.sql",
23 "android/android_startup.sql",
Lalit Maganti7177c7f2019-04-30 15:54:51 +010024]
Lalit Maganti26f69bd2019-04-29 18:23:47 +010025
26config("gen_config") {
27 include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ]
28}
29
30action("gen_merged_sql_metrics") {
Lalit Maganti697cc482019-05-01 14:39:11 +010031 script = "../../../tools/gen_merged_sql_metrics.py"
Lalit Maganti26f69bd2019-04-29 18:23:47 +010032 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 Maganti622676a2019-04-30 14:15:37 +010043
44source_set("lib") {
45 sources = [
Lalit Maganti62211072019-05-10 14:09:58 +010046 "descriptors.cc",
47 "descriptors.h",
Lalit Maganti622676a2019-04-30 14:15:37 +010048 "metrics.cc",
Lalit Magantieb1bf212019-05-08 15:07:16 +010049 "metrics.descriptor.h",
Lalit Maganti622676a2019-04-30 14:15:37 +010050 "metrics.h",
51 ]
52 deps = [
Lalit Maganti7177c7f2019-04-30 15:54:51 +010053 "../../../buildtools:sqlite",
Lalit Maganti622676a2019-04-30 14:15:37 +010054 "../../../gn:default_deps",
55 "../../../include/perfetto/trace_processor",
Lalit Maganti62211072019-05-10 14:09:58 +010056 "../../../protos/perfetto/common:zero",
Lalit Maganti622676a2019-04-30 14:15:37 +010057 "../../../protos/perfetto/metrics:zero",
58 "../../../protos/perfetto/metrics/android:zero",
Lalit Magantie59293b2019-05-22 15:07:39 +010059 "../../../protos/perfetto/trace_processor:metrics_impl_zero",
Lalit Maganti622676a2019-04-30 14:15:37 +010060 "../../protozero:protozero",
61 ]
Lalit Maganti5ccd0a22019-05-15 16:48:04 +010062 public_deps = [
63 ":gen_merged_sql_metrics",
64 ]
Lalit Maganti622676a2019-04-30 14:15:37 +010065}
Lalit Maganti5f3a0182019-05-07 16:40:36 +010066
67source_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}