blob: 0ca39089374f3c8a39f74f0b5f909618273f43f7 [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",
Lalit Maganti7177c7f2019-04-30 15:54:51 +010021]
Lalit Maganti26f69bd2019-04-29 18:23:47 +010022
23config("gen_config") {
24 include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ]
25}
26
27action("gen_merged_sql_metrics") {
Lalit Maganti697cc482019-05-01 14:39:11 +010028 script = "../../../tools/gen_merged_sql_metrics.py"
Lalit Maganti26f69bd2019-04-29 18:23:47 +010029 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 Maganti622676a2019-04-30 14:15:37 +010040
41source_set("lib") {
42 sources = [
43 "metrics.cc",
Lalit Magantieb1bf212019-05-08 15:07:16 +010044 "metrics.descriptor.h",
Lalit Maganti622676a2019-04-30 14:15:37 +010045 "metrics.h",
46 ]
47 deps = [
48 ":gen_merged_sql_metrics",
Lalit Maganti7177c7f2019-04-30 15:54:51 +010049 "../../../buildtools:sqlite",
Lalit Maganti622676a2019-04-30 14:15:37 +010050 "../../../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 Maganti5f3a0182019-05-07 16:40:36 +010057
58source_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}