1# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13import("//base/hiviewdfx/hiview/hiview.gni")
14import("//build/ohos.gni")
15
16config("unified_collector_config") {
17  visibility = [ "*:*" ]
18  include_dirs = [
19    "app_trace/include",
20    "include",
21    "observer/include",
22    "storage/include",
23    "task/include",
24    "power/include",
25    "$hiview_framework/native/unified_collection/collector/inner_include",
26    "$hiview_framework/native/unified_collection/process/include",
27    "$hiview_framework/native/unified_collection/decorator/include",
28  ]
29  defines = [ "PC_APP_STATE_COLLECT_ENABLE = $hiview_unified_collector_PC_app_state_collect_enable" ]
30}
31
32ohos_source_set("unified_collector") {
33  branch_protector_ret = "pac_ret"
34  sanitize = {
35    cfi = true
36    cfi_cross_dso = true
37    cfi_vcall_icall_only = true
38    debug = false
39  }
40  configs = [ ":unified_collector_config" ]
41
42  sources = [
43    "$hiview_framework/native/unified_collection/decorator/unified_collection_stat.cpp",
44    "app_trace/app_trace_context.cpp",
45    "observer/uc_app_state_observer.cpp",
46    "observer/uc_observer_mgr.cpp",
47    "observer/uc_render_state_observer.cpp",
48    "observer/uc_system_ability_listener.cpp",
49    "storage/cpu_storage.cpp",
50    "task/cpu_collection_task.cpp",
51    "task/cpu_perf_dump.cpp",
52    "unified_collector.cpp",
53  ]
54
55  deps = [
56    "$hiview_base:hiviewbase",
57    "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_graphic",
58    "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility",
59    "config:UnifiedCollector_event",
60  ]
61
62  external_deps = [
63    "ability_runtime:app_manager",
64    "ffrt:libffrt",
65    "hilog:libhilog",
66    "hisysevent:libhisysevent",
67    "hitrace:hitrace_dump",
68    "relational_store:native_rdb",
69    "safwk:system_ability_fwk",
70    "samgr:samgr_proxy",
71  ]
72
73  if (has_hiperf) {
74    cflags = [ "-DHAS_HIPERF" ]
75  }
76
77  if (power_manager_enable) {
78    external_deps += [
79      "common_event_service:cesfwk_innerkits",
80      "power_manager:powermgr_client",
81    ]
82    sources += [ "power/power_status_manager.cpp" ]
83    defines = [ "POWER_MANAGER_ENABLE" ]
84  }
85
86  part_name = "hiview"
87  subsystem_name = "hiviewdfx"
88}
89
90group("unittest") {
91  testonly = true
92  deps = [
93    "test/unittest/common:CpuStorageTest",
94    "test/unittest/common:TraceStateChangeTest",
95    "test/unittest/common:UCStateObserverTest",
96  ]
97}
98
99group("moduletest") {
100  testonly = true
101  deps = []
102}
103