blob: 0b602a7bf5db83b92b9d1278e89a0f22f4e63fb3 [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 = [
Ioannis Ilkos5e79b8a2019-05-23 18:09:54 +010018 "error_statistics.sql",
Lalit Maganti7177c7f2019-04-30 15:54:51 +010019 "android/android_mem.sql",
20 "android/android_mem_lmk.sql",
Lalit Maganti5f3a0182019-05-07 16:40:36 +010021 "android/android_mem_proc_counters.sql",
Ioannis Ilkos20d5e8b2019-05-16 15:43:26 +010022 "android/android_startup_launches.sql",
23 "android/android_task_state.sql",
24 "android/android_startup.sql",
Lalit Maganti7177c7f2019-04-30 15:54:51 +010025]
Lalit Maganti26f69bd2019-04-29 18:23:47 +010026
27config("gen_config") {
28 include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ]
29}
30
31action("gen_merged_sql_metrics") {
Lalit Maganti697cc482019-05-01 14:39:11 +010032 script = "../../../tools/gen_merged_sql_metrics.py"
Lalit Maganti26f69bd2019-04-29 18:23:47 +010033 generated_header = "${target_gen_dir}/sql_metrics.h"
34 args = rebase_path(sql_files, root_build_dir) + [
35 "--cpp_out",
36 rebase_path(generated_header, root_build_dir),
37 ]
38 inputs = sql_files
39 outputs = [
40 generated_header,
41 ]
42 public_configs = [ ":gen_config" ]
43}
Lalit Maganti622676a2019-04-30 14:15:37 +010044
45source_set("lib") {
46 sources = [
Lalit Maganti62211072019-05-10 14:09:58 +010047 "descriptors.cc",
48 "descriptors.h",
Lalit Maganti622676a2019-04-30 14:15:37 +010049 "metrics.cc",
Lalit Magantieb1bf212019-05-08 15:07:16 +010050 "metrics.descriptor.h",
Lalit Maganti622676a2019-04-30 14:15:37 +010051 "metrics.h",
52 ]
53 deps = [
Lalit Maganti622676a2019-04-30 14:15:37 +010054 "../../../gn:default_deps",
Mikhail Khokhlova45a95e2019-05-29 13:52:32 +010055 "../../../gn:sqlite",
Lalit Maganti622676a2019-04-30 14:15:37 +010056 "../../../include/perfetto/trace_processor",
Lalit Maganti62211072019-05-10 14:09:58 +010057 "../../../protos/perfetto/common:zero",
Lalit Maganti622676a2019-04-30 14:15:37 +010058 "../../../protos/perfetto/metrics:zero",
59 "../../../protos/perfetto/metrics/android:zero",
Lalit Magantie59293b2019-05-22 15:07:39 +010060 "../../../protos/perfetto/trace_processor:metrics_impl_zero",
Lalit Maganti622676a2019-04-30 14:15:37 +010061 "../../protozero:protozero",
62 ]
Lalit Maganti5ccd0a22019-05-15 16:48:04 +010063 public_deps = [
64 ":gen_merged_sql_metrics",
65 ]
Lalit Maganti622676a2019-04-30 14:15:37 +010066}
Lalit Maganti5f3a0182019-05-07 16:40:36 +010067
68source_set("unittests") {
69 testonly = true
70 sources = [
71 "metrics_unittest.cc",
72 ]
73 deps = [
74 ":lib",
Lalit Maganti5f3a0182019-05-07 16:40:36 +010075 "../../../gn:default_deps",
76 "../../../gn:gtest_deps",
Mikhail Khokhlova45a95e2019-05-29 13:52:32 +010077 "../../../gn:sqlite",
Lalit Maganti6e5a4d12019-05-28 13:49:57 +010078 "../../../protos/perfetto/common:zero",
Lalit Maganti5f3a0182019-05-07 16:40:36 +010079 ]
80}