• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "include",
20    "observer/include",
21    "storage/include",
22    "task/include",
23    "power/include",
24    "$hiview_framework/native/unified_collection/collector/impl/trace/utils/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}
30
31ohos_source_set("unified_collector") {
32  branch_protector_ret = "pac_ret"
33  sanitize = {
34    cfi = true
35    cfi_cross_dso = true
36    cfi_vcall_icall_only = true
37    debug = false
38  }
39  configs = [ ":unified_collector_config" ]
40
41  sources = [
42    "observer/uc_app_state_observer.cpp",
43    "observer/uc_observer_mgr.cpp",
44    "observer/uc_render_state_observer.cpp",
45    "observer/uc_system_ability_listener.cpp",
46    "storage/cpu_storage.cpp",
47    "task/cpu_collection_task.cpp",
48    "task/cpu_perf_dump.cpp",
49    "unified_collector.cpp",
50  ]
51
52  deps = [
53    "$hiview_base:hiviewbase",
54    "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility",
55    "config:UnifiedCollector_event",
56  ]
57
58  defines = [ "PC_APP_STATE_COLLECT_ENABLE = $hiview_unified_collector_PC_app_state_collect_enable" ]
59
60  if (hiview_unified_collector_trace_enable) {
61    sources += [ "observer/uc_telemertry_listerner.cpp" ]
62    deps += [ "$hiview_framework/native/unified_collection/trace_manager:libtrace_manager" ]
63    defines += [ "UNIFIED_COLLECTOR_TRACE_ENABLE" ]
64    if (hiview_unified_collector_low_mem_threshold != 0) {
65      sources += [ "task/trace_cache_monitor.cpp" ]
66      defines += [ "HIVIEW_LOW_MEM_THRESHOLD=${hiview_unified_collector_low_mem_threshold}" ]
67    }
68  }
69
70  external_deps = [
71    "ability_runtime:app_manager",
72    "ffrt:libffrt",
73    "hilog:libhilog",
74    "hisysevent:libhisysevent",
75    "jsoncpp:jsoncpp",
76    "relational_store:native_rdb",
77    "safwk:system_ability_fwk",
78    "samgr:samgr_proxy",
79  ]
80
81  if (power_manager_enable) {
82    external_deps += [
83      "common_event_service:cesfwk_innerkits",
84      "power_manager:powermgr_client",
85    ]
86    sources += [ "power/power_status_manager.cpp" ]
87    defines += [ "POWER_MANAGER_ENABLE" ]
88  }
89
90  if (hiview_unified_collector_trace_for_cpu_high_load) {
91    defines += [ "CATCH_TRACE_FOR_CPU_HIGH_LOAD" ]
92  }
93
94  part_name = "hiview"
95  subsystem_name = "hiviewdfx"
96}
97
98group("unittest") {
99  testonly = true
100  deps = [
101    "test/unittest/common:CpuStorageTest",
102    "test/unittest/common:UCStateObserverTest",
103  ]
104}
105
106group("moduletest") {
107  testonly = true
108  deps = []
109}
110