• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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("//build/ohos.gni")
15import("../../../build/ts.gni")
16config("ebpf_parser_cfg") {
17  if (!is_independent_compile) {
18    configs = [ "${TS_DIR}/gn:ts_config" ]
19  }
20  include_dirs = [
21    ".",
22    "../",
23    "../..",
24    "../../trace_data",
25    "../../base",
26    "../../include",
27    "../../filter",
28    "../../cfg",
29    "../../trace_streamer",
30    "../../proto_reader/include",
31    "${THIRD_PARTY}/protobuf/src",
32    "${THIRD_PARTY}/sqlite/include",
33    "${THIRD_PARTY}/bounds_checking_function/include",
34  ]
35  include_dirs += [
36    "${SRC}/trace_data/trace_stdtype",
37    "${SRC}/trace_data/trace_stdtype/ftrace",
38    "${SRC}/trace_data/trace_stdtype/ftrace/template",
39    "${SRC}/trace_data/trace_stdtype/hilog",
40    "${SRC}/trace_data/trace_stdtype/hiperf",
41    "${SRC}/trace_data/trace_stdtype/hisysevent",
42    "${SRC}/trace_data/trace_stdtype/htrace",
43    "${SRC}/trace_data/trace_stdtype/measure",
44  ]
45  if (is_mingw || is_mac) {
46    include_dirs += [ "${THIRD_PARTY}/elfutils/libelf" ]
47  }
48  if (enable_ts_utest && !use_wasm) {
49    cflags = [
50      "-fprofile-arcs",
51      "-ftest-coverage",
52    ]
53    ldflags = [
54      "-fprofile-arcs",
55      "-ftest-coverage",
56      "--coverage",
57    ]
58    if (is_test) {
59      cflags += [ "-D IS_UT" ]
60    }
61  }
62  include_dirs += [
63    "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/nonlinux",
64    "${THIRD_PARTY}/perf_include/linux",
65    "${THIRD_PARTY}/hiperf/include",
66    "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/innerkits/unwinder/include",
67    "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/interfaces/common",
68    "${THIRD_PARTY}/hiperf/include/nonlinux/linux",
69    "${THIRD_PARTY}/perf_include/hiviewdfx/faultloggerd/common/dfxutil",
70    "${THIRD_PARTY}/hiperf/include/nonlinux/",
71    "${THIRD_PARTY}/perf_include/libbpf",
72  ]
73}
74
75ohos_static_library("ebpf_parser") {
76  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
77  part_name = "${OHOS_PROFILER_PART_NAME}"
78  sources = [
79    "bio_latency_data_parser.cpp",
80    "ebpf_base.cpp",
81    "ebpf_data_parser.cpp",
82    "ebpf_data_reader.cpp",
83    "ebpf_splitter.cpp",
84    "file_system_data_parser.cpp",
85    "paged_memory_data_parser.cpp",
86  ]
87  public_configs = [ ":ebpf_parser_cfg" ]
88  public_deps = [
89    "${OHOS_TRACE_STREAMER_PROTOS_DIR}/protos/types/plugins/memory_data:memory_data_reader",
90    "${PERF_DIR}/hiperf:hiperf_platform_common",
91  ]
92  deps = [
93    "${THIRD_PARTY}/protobuf:protobuf_lite_static",
94    "${THIRD_PARTY}/protobuf:protobuf_static",
95  ]
96}
97