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 "jsoncpp:jsoncpp", 69 "relational_store:native_rdb", 70 "safwk:system_ability_fwk", 71 "samgr:samgr_proxy", 72 ] 73 74 if (has_hiperf) { 75 cflags = [ "-DHAS_HIPERF" ] 76 } 77 78 if (power_manager_enable) { 79 external_deps += [ 80 "common_event_service:cesfwk_innerkits", 81 "power_manager:powermgr_client", 82 ] 83 sources += [ "power/power_status_manager.cpp" ] 84 defines = [ "POWER_MANAGER_ENABLE" ] 85 } 86 87 part_name = "hiview" 88 subsystem_name = "hiviewdfx" 89} 90 91group("unittest") { 92 testonly = true 93 deps = [ 94 "test/unittest/common:CpuStorageTest", 95 "test/unittest/common:TraceStateChangeTest", 96 "test/unittest/common:UCStateObserverTest", 97 ] 98} 99 100group("moduletest") { 101 testonly = true 102 deps = [] 103} 104