1# Copyright (c) 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
17if (hiview_enable_performance_monitor) {
18  config("xperf_service_config") {
19    visibility = [ "*:*" ]
20
21    include_dirs = [
22      ".",
23      "common",
24      "config",
25      "context",
26      "event_publisher",
27      "executor",
28      "monitor",
29      "monitor/converter",
30      "monitor/gateway",
31      "monitor/gateway/executor",
32      "monitor/gateway/reporter",
33      "persistence",
34      "reporter",
35      "reporter/adapter",
36      "reporter/event_poster",
37      "reporter/infrastructure",
38      "scene_data_processor",
39      "scene_data_processor/gateway",
40      "timer",
41
42      "$hiview_base/event_raw/include",
43      "$hiview_base/event_publish/include",
44      "$hiview_base/include",
45      "$hiview_base/logstore/include",
46      "$hiview_base/utility/include",
47      "$hiview_root/include",
48      "$hiview_root/interfaces/inner_api/unified_collection",
49      "$hiview_root/interfaces/inner_api/unified_collection/utility",
50      "$hiview_plugin/faultlogger/common",
51      "$hiview_plugin/faultlogger/service",
52    ]
53
54    cflags_cc = [
55      "-DENABLE_SCREEM",
56      "-fexceptions",
57    ]
58  }
59}
60
61ohos_prebuilt_etc("hiviewxperf_event_file") {
62  source = "config/event/XperfPlugin"
63  part_name = "hiview"
64  subsystem_name = "hiviewdfx"
65  relative_install_dir = "hiview/listener_rule"
66}
67
68ohos_prebuilt_etc("xperfplugins_config") {
69  source = "config/xperformance_plugin_config"
70  part_name = "hiview"
71  subsystem_name = "hiviewdfx"
72  relative_install_dir = "hiview"
73}
74
75ohos_shared_library("xperformance") {
76  if (hiview_enable_performance_monitor) {
77    part_name = "hiview"
78    subsystem_name = "hiviewdfx"
79
80    sanitize = {
81      cfi = true
82      cfi_cross_dso = true
83      debug = false
84    }
85
86    sources = [
87      "XperfPlugin.cpp",
88      "context/BaseContext.cpp",
89      "context/NormalContext.cpp",
90      "executor/ThrExecutor.cpp",
91      "executor/ThrTaskContainer.cpp",
92      "monitor/AppLaunchMonitor.cpp",
93      "monitor/DefaultMonitor.cpp",
94      "monitor/JankAnimatorMonitor.cpp",
95      "persistence/AppLaunchSceneDbAdapter.cpp",
96      "reporter/adapter/AppStartReporterAdapter.cpp",
97      "reporter/adapter/JankAnimatorReporterAdapter.cpp",
98      "reporter/adapter/SimpleAppStartReporterAdapter.cpp",
99      "reporter/event_poster/EventsPoster.cpp",
100      "reporter/infrastructure/AppStartReporter.cpp",
101      "reporter/infrastructure/JankAnimatorReporter.cpp",
102      "scene_data_processor/AnimatorSceneDataProcessor.cpp",
103      "scene_data_processor/AppLaunchSceneDataProcessor.cpp",
104      "scene_data_processor/SceneDataMapDbAdapter.cpp",
105      "timer/AppTimerAdapter.cpp",
106      "timer/SceneTimerOhImpl.cpp",
107    ]
108
109    configs = [ ":xperf_service_config" ]
110
111    deps = [
112      ":hiviewxperf_event_file",
113      ":xperfplugins_config",
114      "$hiview_base:hiviewbase",
115      "config:config",
116    ]
117
118    external_deps = [
119      "c_utils:utils",
120      "hilog:libhilog",
121      "hisysevent:libhisysevent",
122      "init:libbegetutil",
123      "ipc:ipc_core",
124      "samgr:samgr_proxy",
125    ]
126  }
127}
128
129group("unittest") {
130  testonly = true
131  deps = []
132}
133
134group("moduletest") {
135  testonly = true
136  deps = []
137}
138