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.
13
14import("//base/hiviewdfx/hiview/hiview.gni")
15import("//build/ohos.gni")
16
17config("ucolletciton_source_config") {
18  visibility = [ "*:*" ]
19  include_dirs = [
20    "calculator/include",
21    "collector/inner_include",
22    "process/include",
23    "decorator/include",
24    "utils/include",
25    "$hiview_interfaces/inner_api/unified_collection",
26    "$hiview_interfaces/inner_api/unified_collection/utility",
27    "$hiview_interfaces/inner_api/unified_collection/resource",
28  ]
29  defines = [ "PC_APP_STATE_COLLECT_ENABLE = $hiview_unified_collector_PC_app_state_collect_enable" ]
30}
31
32ohos_source_set("ucollection_source") {
33  configs = [
34    ":ucolletciton_source_config",
35    "$hiview_base:logger_config",
36    "$hiview_base/event_report:hiview_event_report_config",
37  ]
38
39  public_configs = [ ":ucolletciton_source_config" ]
40  sources = [
41    "calculator/cpu_calculator.cpp",
42    "calculator/io_calculator.cpp",
43    "collector/common_util.cpp",
44    "collector/cpu_collector_impl.cpp",
45    "collector/gpu_collector_impl.cpp",
46    "collector/hiebpf_collector_impl.cpp",
47    "collector/hilog_collector_impl.cpp",
48    "collector/io_collector_impl.cpp",
49    "collector/memory_collector_impl.cpp",
50    "collector/network_collector_impl.cpp",
51    "collector/perf_collector_impl.cpp",
52    "collector/process_collector_impl.cpp",
53    "collector/process_state_info_collector.cpp",
54    "collector/sys_cpu_usage_collector.cpp",
55    "collector/thermal_collector_impl.cpp",
56    "collector/thread_state_info_collector.cpp",
57    "collector/trace_collector_impl.cpp",
58    "collector/utils/app_event_task_storage.cpp",
59    "collector/utils/trace_flow_controller.cpp",
60    "collector/utils/trace_manager.cpp",
61    "collector/utils/trace_storage.cpp",
62    "collector/utils/trace_utils.cpp",
63    "collector/utils/trace_worker.cpp",
64    "collector/wm_collector_impl.cpp",
65    "decorator/cpu_decorator.cpp",
66    "decorator/decorator.cpp",
67    "decorator/gpu_decorator.cpp",
68    "decorator/hiebpf_decorator.cpp",
69    "decorator/hilog_decorator.cpp",
70    "decorator/io_decorator.cpp",
71    "decorator/memory_decorator.cpp",
72    "decorator/network_decorator.cpp",
73    "decorator/perf_decorator.cpp",
74    "decorator/process_decorator.cpp",
75    "decorator/thermal_decorator.cpp",
76    "decorator/trace_decorator.cpp",
77    "decorator/wm_decorator.cpp",
78    "process/process_status.cpp",
79    "utils/cpu_util.cpp",
80  ]
81
82  if (has_hiprofiler) {
83    sources += [
84      "collector/mem_profiler_collector_impl.cpp",
85      "decorator/mem_profiler_decorator.cpp",
86    ]
87  }
88
89  deps = [ "collector/device_client:collect_device_client" ]
90
91  external_deps = [
92    "ability_base:want",
93    "ffrt:libffrt",
94    "hilog:libhilog",
95    "hisysevent:libhisysevent",
96    "hitrace:hitrace_dump",
97    "init:libbegetutil",
98    "relational_store:native_rdb",
99    "zlib:libz",
100  ]
101
102  cflags = []
103  if (has_hiprofiler) {
104    cflags += [ "-DHAS_HIPROFILER" ]
105    external_deps += [ "hiprofiler:libnative_daemon_client" ]
106  }
107
108  if (has_hiperf) {
109    cflags += [ "-DHAS_HIPERF" ]
110    external_deps += [ "hiperf:hiperf_client" ]
111  }
112
113  if (thermal_manager_enable) {
114    cflags += [ "-DTHERMAL_MANAGER_ENABLE" ]
115    external_deps += [ "thermal_manager:thermalsrv_client" ]
116  }
117
118  defines = []
119  if (is_wifi_enable) {
120    external_deps += [ "wifi:wifi_sdk" ]
121    defines += [ "COMMUNICATION_WIFI_ENABLE" ]
122  }
123
124  part_name = "hiview"
125  subsystem_name = "hiviewdfx"
126}
127
128group("unittest") {
129  testonly = true
130  deps = [
131    "collector/utils/test:TraceStorageUnitTest",
132    "decorator/test:DecoratorUnitTest",
133  ]
134}
135