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/thread_state_info_collector.cpp",
56    "collector/trace_collector_impl.cpp",
57    "collector/utils/app_event_task_storage.cpp",
58    "collector/utils/trace_flow_controller.cpp",
59    "collector/utils/trace_manager.cpp",
60    "collector/utils/trace_storage.cpp",
61    "collector/utils/trace_utils.cpp",
62    "collector/utils/trace_worker.cpp",
63    "collector/wm_collector_impl.cpp",
64    "decorator/cpu_decorator.cpp",
65    "decorator/decorator.cpp",
66    "decorator/gpu_decorator.cpp",
67    "decorator/hiebpf_decorator.cpp",
68    "decorator/hilog_decorator.cpp",
69    "decorator/io_decorator.cpp",
70    "decorator/memory_decorator.cpp",
71    "decorator/network_decorator.cpp",
72    "decorator/perf_decorator.cpp",
73    "decorator/process_decorator.cpp",
74    "decorator/trace_decorator.cpp",
75    "decorator/wm_decorator.cpp",
76    "process/process_status.cpp",
77    "utils/cpu_util.cpp",
78  ]
79
80  if (has_hiprofiler) {
81    sources += [
82      "collector/mem_profiler_collector_impl.cpp",
83      "decorator/mem_profiler_decorator.cpp",
84    ]
85  }
86
87  deps = [ "collector/device_client:collect_device_client" ]
88
89  external_deps = [
90    "ability_runtime:app_manager",
91    "ffrt:libffrt",
92    "hilog:libhilog",
93    "hisysevent:libhisysevent",
94    "hitrace:hitrace_dump",
95    "init:libbegetutil",
96    "relational_store:native_rdb",
97    "zlib:libz",
98  ]
99
100  cflags = []
101  if (has_hiprofiler) {
102    cflags += [ "-DHAS_HIPROFILER" ]
103    external_deps += [ "hiprofiler:libnative_daemon_client" ]
104  }
105
106  if (has_hiperf) {
107    cflags += [ "-DHAS_HIPERF" ]
108    external_deps += [ "hiperf:hiperf_client" ]
109  }
110
111  defines = []
112  if (is_wifi_enable) {
113    external_deps += [ "wifi:wifi_sdk" ]
114    defines += [ "COMMUNICATION_WIFI_ENABLE" ]
115  }
116
117  part_name = "hiview"
118  subsystem_name = "hiviewdfx"
119}
120
121group("unittest") {
122  testonly = true
123  deps = [
124    "collector/utils/test:TraceStorageUnitTest",
125    "decorator/test:DecoratorUnitTest",
126  ]
127}
128